As I mentioned in this post, I described, briefly how my development environment is set up, and how I installed ColdFusion 8 onto the same JRun server where I have ColdFusion 7 installed. A reader inquired about the JVM and if there are any conflicts. Well, the answer is no, there are not. Why? Well, becasue when you deploy ColdFusion 8 as a .ear file onto a server running ColdFusion 7, JRun will use the JRE specified in the java.home variable in {jRun root}/bin/jvm.config, which in my case was 1.4.2_09.
Now, I have been running this configuration since the public beta and have not run into any issues with performance, or even errors occurring when running ColdFusion 8 code. However, I wanted to set-up my ColdFusion 8 to use the same JRE it would if I had done a different install (stand alone, or multi-server). This was easy enough as you can create custom jvm.config files and use them to run your JRun ‘servers’.
Here’s to do it.
Disclaimer: This is for Windows only. I assume the procedure would be similar in a different environment.
- Download the latest Java SDK and install it. (You may be able to use the JRE alone, but I didn’t test this)
- Make a copy of jvm.config (located in {JRun root}/bin } and name it jvm_cf8.config. (You can name it whatever you would like, but the rest of the instructions assume you use this name)
- Change the java.home variable from “C:/JRun4/jre” (It may be different for you) to {new SDK Install path}/jre and save the file.
- If its running, stop the ColdFusion 8 service.
- Open a command window and “cd” to {JRun Root}/bin
- Test the new config by typing jrun -config jvm_cf8.config -start {the name of your ColdFusion 8 server in Jrun}. If you don’t get any errors, you can now set up your Windows service to use this config file.
- Pressing crtl+c should shut down the JRun server you just started.
- Type the following to remove the windows service jrunsvc -remove {the name of your ColdFusion 8 server in JRun}
- Now you need to reinstall the Windows service and tell it to use the new config jrunsvc -install {the name of your ColdFusion 8 server in JRun} -config jvm_cf8.config.
- You should now be able to start ColdFusion 8 from the Services MMC in Windows.
To verify you are using the updated JVM, log into the ColdFusion Administrator for ColdFusion 8 and go to ‘System Information’ (It’s the blue icon on the top right side of the page) and check the JRE and JVM values.
UPDATED: As noted by Andy Allan in a comment below, when you copy jvm.config and update the java.home variable, you also need to update the java.library.path variable as well. This variable should point to you new instance of ColdFusion. He also warns to be careful with pathing to the new instance as there may be some subtle differences between the new instance, and the ‘default’ instance.
Comments on: "CF7, CF8, Jrun and the JVM" (6)
Simply copying the jvm.config isn’t enough, you also have to modify it otherwise it still points to the original “cfusion” instance.
You’ll need to modify the java.library.path variable to point to the new server, and watch for potential path differences. The “cfusion” instance uses cfusion-ear/cfusion-war whereas your new instances *may* use cfusion.ear/cfusion.war
This is particularly important if you are using sandboxes.
LikeLike
@Andy – Thanx for pointing this out.
LikeLike
In reference to bullet #1, you’re correct to question downloading just the JRE: According to http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/jdkfiles.html, the JRE is identical between the JDK and the JRE-only package (which makes sense). However, I’ve found more than once that installing from the JRE-only package may resultin an installation with only jre/bin/client/ and not jre/bin/server/ (which CF requires).
We discovered this the hard way during the DST-upgrade process (to 1.4.2_11); I have no explanation as to why that server folder wasn’t available after the installation completed (perhaps an option checkbox I missed?) — so this is really just a heads-up to check for that missing server folder if CF won’t start after you switch to a JRE-only installation.
LikeLike
Thanks, Doug. Very helpful.
I’ll just add a little extra info. When one adds the service back, they may want to add a little more info to the -install line to affect the name and displayname of the service as it will displayed in the Services panel, otherwise it picks defaults you may not care for.
For instance, if you’re running the multi-server instance, and are making this change to the default instance (cfusion) you’d likely want to have the namd and display name set to what they were originally, which is “Macromedia JRun CFusion Server”. To do that, you just add them to the line Doug showed, as in:
jrunsvc -install cfusion “Macromedia JRun CFusion Server” “Macromedia JRun CFusion Server” -config
newjvm.config
You can see more by just issuing jrunsvc -install, which will display help.
Someone may wonder why one would give the default instance its own jvm.config, but I’m using this approach to define the CF8 debugger settings in a separate config than the default one injrun4bin, for reasons I’ll be explaining in a later blog entry.
BTW, there was also a description in the service that I didn’t notice was there before I removed it. One may want to capture that as well. You’d just add that as another quoted string just before the -config argument.
Hope that helps someone else.
LikeLike
@Charlie – Just FYI, it was Scott Stroz who wrote that last entry. 🙂 The new (soon to be released) alagad.com and alagad blog will help clear up that confusion.
LikeLike
Hi! Really useful post you have there. It really helped me a ton!
LikeLike