Coldfusion MX 6.1 and Java 1.6

The objective of this post is explain the necessary steps to execute Coldfusion MX 6.1 using Java 1.6 (instead of the default one: Java 1.4).

First of all, we have to take a look at the file jvm.config to see which folder the variable java.home points to. This var is used by Coldfusion to reach the JRE which will execute itself.

By default this var points to {CFUSION_HOME}/runtime/jre

We have got many options:

1-Modify this var to point to the folder where the JRE we want to use is.
2-Let the var as it is, delete de JRE folder referred and:
   -Make a softlink to the JRE we want to use. For example, to use the JRE of JDK 1.6, we have to softlink as follows: ln -s {JDK_HOME}/jre {CFUSION_HOME}/runtime/jre
   -Make a full copy of the JRE we ant to use to {CFUSION_HOME}/runtime

Now if we try to launch Coldfusion MX with the new JRE, it won’t boot and we will get a clearly message showing that we have to add -Djmx.invoke.getters=true to the jvm configuration parameters. So we have to edit jvm.config and write at the end of the var java.args the previous text.

Now we can launch Coldfusion with the new Java virtual machine without errors.

Even thought this changes only work if we don’t try to use services in which Coldfusion must compile (as web services). In this case, Coldfusion will compile the .java files from the web services with its internal compiler: jikesw. It will compile that files with version 1.4 so if it tries to execute the .class files with the JRE 1.6 (the one that is executing), will throw an error.

If we want to use web services with Coldfusion MX 6.1 and Java 1.6 we must do more changes.

First of all, we have to download the Apache Axis libs from http://www.apache.org/dyn/closer.cgi/ws/axis/1_4

We only need the following libs of the Axis packet:
axis.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
wsdl4j-1.5.1.jar

We must copy that libs to {CFUSION_HOME}/lib

Then we delete the old files that also contains that libs:
{CFUSION_HOME}/lib/webservices.jar
{CFUSION_HOME}/runtime/lib/webservices.jar

And we do the same with the compiler Jikesw, located at {CFUSION_HOME}/runtime/bin/jikesw

Now we overwrite the file tools.jar (located at {CFUSION_HOME}/lib) with the one that comes with the JDK we are using. In our particular case:
cp /apps/java/jdk1.6.0_07/lib/tools.jar /apps/cfusion/lib/

Every time we copy files to the lib folder, we must verify that those files have Read Access by the user used to execute Coldfusion. Besides we must reboot Coldfusion so it uses the new libs.

With these changes you will be able to run web services served by a Tomcat/Jboss and compiled with Java 1.6. In addition, we will get more stability thanks to the better memory management of Java 1.6 and its garbage collector.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Cerrar
Enviar por Correo