Copy link to clipboard
Copied
Hi,
There are some topics on this on the forum, but I am still not sure what to do.
We have the application and several clients with different CF server versions. I tried to compile some files on CF7 with -deploy option, but CF9-10 gives error "javax/servlet/jsp/JspContext". Does somebody know the workaround?
Thanks,
Anton
Anton,
That's what I suspected. Since each version of ColdFusion typically runs on a different major release of Java (1.4 vs. 1.6, etc.), compiled code from one release of ColdFusion will likely not work on another version. Even if the same Java version is being used (1.6) between CF9 and CF10, there are no guarantees that the compiled code is compatible between the ColdFusion versions, especially going backward from CF10 to CF9. I think you'll need to compile separately for each version of Co
Copy link to clipboard
Copied
Anton,
Do you get that error when you run the "cfcompile -deploy ..." command on CF9/10, or when you try to deploy the compiled files from CF7 onto CF9/10?
-Carl V.
Copy link to clipboard
Copied
Carl,
I get this message in the CF error log then I try to access complied file on site. Site screen is just empty.
I have tried to compile files on CF7, Java Ver 1.4.2_09 and run it on CF9, Java Ver 1.6.0_17. Both are 32 bit.
Also I tried to compile file on CF10, Java Ver 1.6.0_34, 64 bit and run on both servers above. I suppose, bitness should match.
Of course, CF7 compiled files work fine on the same CF7 server.
May be I should mention that only reason we want to compile files is to prevent clients to see the code. Encoding doesn't work for us, as it is too easy too decode.
Anton
Copy link to clipboard
Copied
Anton,
That's what I suspected. Since each version of ColdFusion typically runs on a different major release of Java (1.4 vs. 1.6, etc.), compiled code from one release of ColdFusion will likely not work on another version. Even if the same Java version is being used (1.6) between CF9 and CF10, there are no guarantees that the compiled code is compatible between the ColdFusion versions, especially going backward from CF10 to CF9. I think you'll need to compile separately for each version of ColdFusion.
-Carl V.
Copy link to clipboard
Copied
Carl,
Thank you for reply.
BTW, is it any way to determine Java version and bitness in CF code?
Thanks,
Anton
Copy link to clipboard
Copied
Anton,
You can instantiate the java.lang.System object, and get specific properties from Java:
<cfset JavaSys = CreateObject("java", "java.lang.System")>
<cfoutput>
<p>#JavaSys.getProperty("java.version")#</p> <!--- will give you the Java version --->
<p>#JavaSys.getProperty("sun.arch.data.model#</p> <!--- will give you the JVM bitness, but there is some concern whether this is being deprecated and if it works on non Oracle (formerly Sun) JVMs) --->
<p>#JavaSys.getProperty("os.arch")#</p> <!--- will also give bitness as either "x86" for 32-bit or "amd64" for 64-bit, but there is some disagreement on whether this reports the OS or JVM bitness --->
<p>#JavaSys.getProperty("java.vm.name")#</p> <!--- will give a descriptive name containing the bitness, like: "Java HotSpot(TM) 64-Bit Server VM" --->
</cfoutput>
My comments on the 2nd and 3rd properties above were drawn from this StackOverflow thread: http://stackoverflow.com/questions/2062020/how-can-i-tell-if-im-running-in-64-bit-jvm-or-32-bit-jvm-...
HTH,
-Carl V.
Copy link to clipboard
Copied
Great Carl. Thanks a lot again.
Anton