Wednesday, August 08, 2007

ColdFusion and WebService : "class file has wrong version"

I can't even count the number of times I have seen this error while QA folks were running webservices regressions for ColdFusion 8. Everytime, someone was running webservices tests on a J2EE configuration they used to get an error :

coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler:
....
class file has wrong version 49.0, should be 48.0

I saw the same error posted in the public forum where the user had deployed ColdFusion 8 on JRun with JDK1.5 and was trying to invoke webservice. And hence this blog entry :-)

This error comes because of incompatibility between the tools.jar and the JVM version. ColdFusion 8 ships Java 1.6's tools.jar (you will find it in cfusion/lib) which is of course incompatible with any other JDK/JRE version. You will see the same behavior with ColdFusion 7 as well, if you run it on a JVM other than 1.4. So the rule of thumb is - if ColdFusion is running on a JVM version other than the shipped one, you must ensure that the tools.jar is in synch. In short, you will need to copy JDK's tools.jar to cfusion/lib.

3 comments:

Rahul said...

I also had a small writeup on this one at http://tinyurl.com/37g552

Unknown said...

Thank you sooo much, this fixed our issue on AIX as well with ColdFusion8.

Anonymous said...

How can I compile a cfc web service on CFMX 6.1 if I have upgraded to JDK1.5?

Here's the error I'm having:

cannot access java.lang.Object
bad class file: C:\jdk1.5.0_12\jre\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0