Welcome!

ColdFusion Authors: Maureen O'Gara, Hovhannes Avoyan, Yakov Fain, Pat Romanski, Liz McMillan

Related Topics: ColdFusion

ColdFusion: Article

CFDJ Feature — It Is Possible!

Simultaneous development with CF7 and CF8

In this form, you will need to specify a name for the server - this is the JRun server and will only be needed for recognition purposes so that you know which instance you are working with later. The server directory should be auto-populated as you enter a name for the server and my recommendation is to leave this as is.

At this point, we have no EAR or WAR file to use to create this instance, so leave that field blank. Since I am installing ColdFusion 8 on Windows Vista, I can go ahead and check the two check boxes to have a Windows Service set up to automatically start the ColdFusion instance upon boot. If you are installing ColdFusion 7 first on Windows XP, this should work as well. Click the Submit button and after a brief wait you should have a new ColdFusion instance ready to go. The acknowledgment screen should list some details about your new instance and give you a link to the ColdFusion administrator for that instance - remember, this is a completely separate instance with its own ColdFusion administrator. The next step is to connect this instance up to our Web server of choice - IIS 7 in my case. Adobe has helped us out here by including the "Web Server Configuration Tool." A shortcut to this tool should have been installed in your start menu. Selecting this option will show a command prompt window and a little Java window as seen in Figure 5.

To configure your Web server to work with your new ColdFusion instance, click the Add button. A new window will appear with a configuration form based upon your Web server setup. Using IIS, mine looks like Figure 6.

In the first section, you will want to select the JRun Server instance with the name you provided in the ColdFusion administrator when you created the new ColdFusion instance. In the second section, you'll want to select the Web site to which you wish to connect this JRun instance and then select the "Configure Web server..." check box in order to have all of the mappings, etc., set up. Last, click OK and the script should display some information in a command-prompt window before returning to the original Web server configuration window and showing the new ColdFusion instance. Just browse to the Web address associated with the selected Web site and you should be good to go. You have just created your first (officially it is your second instance as the default CF Administrator is running on an instance called "cfusion") ColdFusion multi-instance server configuration.

Your Second ColdFusion Instance
Now that we have ColdFusion up and running in a multi-instance server configuration, it is time (in my case) to get ColdFusion 7 set up. With Windows Vista, it can be a bit tricky to get the installer working, but what you need to do is run it with full administrative rights; to do this, right-click on the installer icon and select "Run as Administrator." Give it a few seconds and the installer should start up. As with the ColdFusion 8 install, the portions of the installer to focus on are the installation configuration and the default path names.

As before, agree to the license and select the developer edition for the ColdFusion 7 installer. This time, since we already have a Java Web server installed as part of the ColdFusion 8 install, we want to select the J2EE installation configuration option as shown in Figure 7.

What this option does is have the installer "deploy" ColdFusion as an EAR file that the JRun server, which was installed with the previous ColdFusion 8 install, will accept and turn into a working ColdFusion 7 server.

Like the ColdFusion 8 install, I chose to set the base installation path for ColdFusion and any associated add-ons (search, etc.) to C:\CFusionMX7 to make sure there is a difference between the ColdFusion 8 and ColdFusion 7 installs. During this installation, a new screen will present itself requesting the "Context Root." Since we are deploying this EAR to our local JRun server and wish it to behave as much as possible like the "standard" installation of ColdFusion, make sure this value is set to "/". This will set up the ColdFusion instance to respond to the root localhost address for your development machine. From this point on, the installer should look pretty familiar.

Deploying ColdFusion 7 to JRun
After the ColdFusion 7 installer completes, you should find a set of files at the installation path you provided (C:\CFusionMX7\ in the example). In this folder, you should find a file named "cfusion.ear". This is your ColdFusion 7 installation that now needs to be deployed to the previously installed JRun application server. To do this, we can utilize the same interface in the default ColdFusion administrator that we used to create a new instance of ColdFusion 8. Simply select the "Instance Manager" option under the "Enterprise Manager" option on the ColdFusion Administrator page as shown in Figure 8.

Specify a server name and path as you did before, but when you get to the EAR/WAR file field, insert the path to the "cfusion.ear" file that was generated during the ColdFusion 7 installation. By doing this, the instance manager will deploy the ColdFusion 7 instance to the JRun server instead of the default ColdFusion 8 instance.

Last, for a ColdFusion 7 instance, you do not want to select the check box to have the instance manager create an NT service for this instance. We will do that manually as there are a few things that need changing in order to get ColdFusion 7 to start properly. Now, click the Submit button to add the new ColdFusion instance and we'll almost be finished. This will be the same process that is followed every time a new instance of ColdFusion 7 is deployed, using the same cfusion.ear file each time.

Last, the JVM
JVM is short for Java Virtual Machine and is one of those little Java components that is necessary for ColdFusion or most any Java application to run. The problem we have is that by installing ColdFusion 8 first, any other application set up on that same JRun server will by default use JVM version 1.6. While this is perfect for ColdFusion 8, ColdFusion 7 does not support a JVM version above 1.4.2.

To get around this, first download and install JVM 1.4.2 separately from the Java Web site (http://java.sun.com/j2se/1.4.2/download.html). In this case, you'll need to install the full SDK and not just the JRE as ColdFusion relies on server components of the library that are not part of the JRE. Once the 1.4.2 version of the JVM is installed, we can use it to run the ColdFusion 7 instances.

To set up JRun to utilize the different JVM, navigate to c:\JRun4\bin and find the jvm.config file. Make a copy of this file (jvm_cfmx7.config) and then open it in your favorite text editor. At the top of the file, there should be a line that starts as "java.home". This line should be changed to read "java.home=c:/j2sdk1.4.2_14/jre" with the path pointing to the location where the 1.4.2 version of the JVM was installed. Save the file and then we need to use this file to configure the new ColdFusion 7 instance.

Remember, during the process of adding the new instance, the check box to create the Windows Service was left blank. This is intentional as by default each instance will use the version 1.6 JVM. However, Adobe has included a command-line utility to create a Windows Service and, using that utility, we can instruct the service to use the new jvm_cfmx7.config file and settings that we just created. The command-line utility string should look something like this.

c:\jrun4\bin\jrunsvc.exe -install [JRun Server Name]
"Adobe ColdFusion 7 AS [JRun Server Name]"
"Adobe ColdFusion 7 AS [JRun Server Name]"
-config [JVM Config File Name]

This command will create a new Windows Service that upon system boot will start the JRun server specified and use as its configuration the customized JVM config (jvm_cfmx7.config) file created earlier.

The last step to getting the ColdFusion 7 instance working is to set it up with your chosen Web server. There is a problem here because the Web Site Configuration Tool may work or may not again because of the JVM version discrepancy between ColdFusion 7 and ColdFusion 8. There is another command-line script that will take care of the configuration automatically and could easily be bundled with the above script for setting up the Windows service.

c:\j2sdk1.4.2_14\jre\bin\java -jar c:\jrun4\lib\wsconfig.jar -server
"[JRun Server Name]" -ws iis -site "[IIS Web Site Name]" -coldfusion -v

This command, launched using the 1.4.2 JVM version, will add the Web site connectors to the IIS Web site with the specified name, attach it to the JRun server with the specified name, and set it up for ColdFusion 7.

The Ultimate Development Workstation
At this point, you should have a working ColdFusion 8 instance side-by-side with a working ColdFusion 7 instance. If you need additional instances, they should be very simple to set up. Additional ColdFusion 8 instances are created using the default ColdFusion administrator and the Web Site Configuration Tool. Additional ColdFusion 7 instances are created using the default ColdFusion administrator, the cfusion.ear file, and the two command-line scripts mentioned earlier.

Hopefully, this will allow you to benefit from some of my hours of frustration and allow you to have a dual-CF development box that is easy to use and learn on at the same time.

More Stories By Jeff Chastain

Jeff Chastain has been developing software applications using object-oriented programming for over 12 years and has been developing Web applications in ColdFusion for over 8 years. He has experience in a variety of industries, from Fortune 500 companies to his own consulting practice. Currently, Jeff is an applications architect and systems developer for Alagad, Inc., and contributes to the blog at http://www.doughughes.net.

Comments (7) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
marc_44 09/19/09 06:06:00 AM EDT

Hi,
I tried to install Coldfusion 8.01 and Coldfusion 9Beta on Windows 7 as described in this article. I succeeded to install the ear file in Jrun4 but I cannot get IIS7 or Apache (2.28) to recognize the installed Aplication server. In IIS 7 I make a website and use the Adobe Webserver connector to install the connector, in Apache I use Virtual Hosts and add the modified lines about serverstore and bootstrap. Did anyone succeed?
Marc

Gabriel Rose 04/29/08 10:10:20 PM EDT

I was also getting the service-specific error 2 - it appears the installer for JVM 1.4.2 overwrote the version of the JVM in the Jrun4/jre directory. The original version was Version 6 which has been changed to 1.4.2. I had backed up the JRun4 directory before installing so copied the original jre folder back. Now all the services are starting happily.

David Brown 01/11/08 08:25:49 PM EST

Hi Eric, We have the same issue with our 2 servers that are running the multi instances. I have not tried to worry about it since I really don't need to start them that often. I hope someone can help.

Eric Davis 01/11/08 05:58:42 PM EST

I've got 2 cf8 instances and 2 cf7 instances installed. The odd thing is that the jrun launcher and cf administrator don't recognize that the cf7 instances are running. I can stop and restart them just fine using the JRun Launcher, but only after I use the Windows Service MMC to stop the services. Any ideas on why this is happening?

Drew 11/27/07 10:13:28 AM EST

This doesn't *actually* work. There is a bug in CF8 where it doesn't know where the CFIDE is mapped to. You must set this in neo-runtime.xml. I couldn't figure out where to put the tag and only after putting it inside every did it actually work. Here's the line:
c:\inetpub\cfmx8root

After coldfusion loads administrator control correctly, it destroys the nice formatting of this file and it becomes one long line.

Marc 09/03/07 05:14:50 AM EDT

Thanks, This helped a lot. I figured out how to use CF7/CF8 on Apache/Jrun4. Interested? Mail me.

David Brown 08/12/07 09:40:28 PM EDT

I have followed the steps of this article, but continue to get a error every time I try to start the Adobe ColdFusion 7 as CF7 service added from the command prompt. In Jrun Console I can see the CF7 server running and I did copy the config file and changed home to java.home=c:/j2sdk1.4.2_15/jre
The service installs fine, but when I try to start it in services I get the following error.

The Adobe ColdFusion 7 AS CF7 service terminated with service-specific error 2 (0x2).

Any suggestions?