An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Java 6 and ColdFusion 8

January 14, 2009 ·

Update: The Java 6 class loader bug mentioned in this post was fixed in Update 10. I just upgraded a 64-bit Red Hat Linux server to Java 6 Update 11 and changed the jvm.config file to specify the new JDK's jre directory for java.home. After restarting the server, it was able to serve up the first page of a complex Model-Glue / ColdSpring / Transfer application in just a few seconds. With the default JDK installed by ColdFusion 8 (1.6.0_04), it took between 30 and 60 seconds to serve that first page. I have updated this blog post accordingly. Thanx to Charlie Arehart for prodding me earlier today on this issue.
Some people have been noticing dramatically slower application startup times on ColdFusion 8 compared to ColdFusion MX 7. I've seen a lot of complaints about shared hosting systems where applications timeout. Since CF8 is so much faster than CFMX7, you might wonder why application startup times can be so much worse.The answer is Java 6. For all the other performance improvements and increased functionality in Java 6, it introduced a bug in the class loader that causes substantially slower class loading. You can see a discussion of the problem on Sun's forums. I rolled my Mac back from Java 6 Developer Preview to Java 5 and noticed a huge difference: an application that took six and a half minutes on Java 6 to start from cold, on a server with no class files in cfclasses, took around 50 seconds on Java 5. You're only going to see this on applications that cause a large number of classes to be loaded at startup, i.e., framework-based applications that rely heavily on CFCs. You actually suffer the slow class loading on all applications but it's particularly noticeable on framework-based apps, especially ones that use Transfer (due to the high number of class files generated). My recommendation for the time being is to ensure you are using Java 5 to is to upgrade your Windows or *nix JDK to Java 6 Update 11 and use that to power ColdFusion 8. On Windows and Linux, you'll need to download and install the Java 6 Update 11 JDK from http://java.sun.com and then change your environment variables so that CF8 picks the right JDK (start CF8 from the console and you can easily see what JDK it is using). Changing java.home in jvm.config is probably the easiest way to tell CF8 to use the new JDK - it needs to point to the jre directory inside the JDK install. On a Mac it's easier to revert to Java 5 which is the default JDK and CF8 automatically uses it. Adobe are aware of the issue (in fact, they pointed us at the discussion on Sun's forums).

Tags: coldfusion · j2ee

49 responses

  • 1 Marko // Dec 5, 2007 at 10:31 PM

    I've had problems invoking webservices with CF8 using Java 5 on my Mac. I use webservices on a daily basis, so I was forced to upgrade to Java 6. Has anyone else had the same problem? I found a solution here http://www.petefreitag.com/item/652.cfm

    I haven't noticed a significant difference in the startup time though, but I'll take your word for it :)
  • 2 Peter Bell // Dec 5, 2007 at 11:42 PM

    It took Mark a little longer to write up, but some good additional details here:

    http://www.compoundtheory.com/?action=displayPost&ID=270
  • 3 Marco Di Folco // Dec 6, 2007 at 4:20 AM

    Does it mean that the server version of CF8 on Windows and Linux ships with Java 6 as default JVM?

    I haven't upgrade to CF8 yet ...

    Thanks.
  • 4 William // Dec 6, 2007 at 4:46 AM

    Could you please give instructions on how this can be done on Windows XP
  • 5 Bernie Dolan // Dec 6, 2007 at 6:01 AM

    "On Windows and Linux, you'll need to download and install the Java 5 JDK and then change your environment variables so that CF8 picks the right JDK..."

    Which will involve updating the java.home line of ColdFusion's jvm.config file to point to the new Java 5 install. Thanks for tip Sean, for some reason I was under the impression CF8 had shipped with 1.5.
  • 6 Davo // Dec 6, 2007 at 6:58 AM

    Great post, thanks Sean - do you have any reference pointers (online documentation, for example) to implement your recommendations?

    Cheers,

    Davo
  • 7 Terry Schmitt // Dec 6, 2007 at 7:13 AM

    Very interesting. Since Java 1.6 ships with CF8, I wonder if there are any compatibility issues with running 1.5?
  • 8 David Stamm // Dec 6, 2007 at 7:59 AM

    My dev shop is planning how/when to upgrade to CF8, so thanks for the heads-up, Sean.

    You mentioned that startup issues are more noticeable with certain frameworks. Is this happening when application-scoped CFCs are instantiated? Or is this more an issue with CFCs that dynamically load Java classes, such as Mark Mandel's JavaLoader?
  • 9 Sean Corfield // Dec 6, 2007 at 8:18 AM

    @David Stamm, Mark Mandel's blog post - I'll repeat the link here - has deeper information about what exactly causes the problem:

    http://www.compoundtheory.com/?action=displayPost&ID=270

    @Terry Schmitt, CF8 on Mac uses the default Java installation which is Java 5 normally so, no, there be no compatibility issues (Pete Freitag's blog post notwithstanding).

    @Davo, no, by default, Mac users who did not upgrade to Java 6 will not be affected and if they upgraded, they'll know how to downgrade. I don't use Windows so I can't give instructions for that. For Linux, you ought to know how to install JVMs/JDKs anyway so I'm not helping there either :)

    @Bernie, yup, sounds like the right approach. For Java in general you can set the JAVA_HOME environment variable to point to Java 5 - exact details vary across operating systems.

    @William, no. I don't use Windows.

    @Marco, yes, CF8 lays down Java 6 on Windows and Linux (not on Mac).

    @Marko, I was a bit surprised by Pete's post because I had only suggested moving CF8's tools.jar out of the way when he'd pinged me and I'd viewed the upgrade to Java 6 as a separate issue altogether. I think that just moving tools.jar should solve any compatibility issues you hit (because the tools.jar file that ships with CF8 probably assumes Java 6). Moving tools.jar out of the way causes CF to fall back to the installed Java compiler.
  • 10 Sean Corfield // Dec 6, 2007 at 8:59 AM

    FWIW, I just tried the web service example code Pete posted on his blog and it works perfectly with CF8 on Java 5 *without* removing the tools.jar file. Not sure why Pete had a problem but it does not appear to be a Java 5 / Java 6 issue, at least for me.

    @Marko, contact me privately to debug your web service problem if you want.
  • 11 Fred Wenger // Dec 6, 2007 at 10:20 AM

    We are getting ready to upgrade at my office and we use Fusebox 5. I know we have a lot of .cfm files for each application with Fusebox, but does that consitute: "cause a large number of classes to be loaded at startup"? Each fuse file is compiled into a class, but is that what you mean?

    Thanks a lot.
  • 12 Laurence // Dec 6, 2007 at 1:37 PM

    Sorry this is a bit off topic. Has anyone deployed CF8 on JBoss and then deployed their CF Application onto JBoss using an .EAR file? I can't seem to have CF8 and my Application in the server/default/deploy folder simultaneously? If I have both, then JBoss throws errors on start up. I've tried not including the CFAdmin when creating the jar, but there is sill a /CFIDE dir created and I think that's causing issues.

    If you know of a resource that can help, I would appreciate it.
  • 13 Douglas Knudsen // Dec 6, 2007 at 1:39 PM

    I might be bleeding ignorance here, but does this affect only server software? What about IDEs like Eclipse, eh?

    DK
  • 14 Sean Corfield // Dec 6, 2007 at 2:42 PM

    @Fred, unlikely. Fusebox by itself does not cause a large number of class files to be generated *at startup time*.

    @Laurence, you're right, that's off-topic for this post. However, I will confirm you cannot have multiple EARs in the same server instance that contain ColdFusion. You either need a separate server instance or you need to use WARs. And that's not a JBoss thing really - I'm pretty sure you'll hit that on any J2EE server: it's just the way J2EE servers work.

    @Douglas, you can configure each Java application to use a separate JVM / JDK if you want.
  • 15 Dan // Feb 20, 2008 at 5:20 AM

    I'm just wondering if this issue still exists with the latest 1.6 Update 4?
  • 16 Sean Corfield // Feb 20, 2008 at 10:46 AM

    @Dan, you could check which bugs they claim are fixed in the Java update - see the link to the Sun bugbase above for details. I know that the bug *has* been fixed at some point in the Java 6 stream and is not present in the Java 7 stream.
  • 17 Drew Morris // Feb 28, 2008 at 9:35 AM

    Has anyone been able to figure out what version of the JVM we would need to use to keep 1.6 while avoiding this bug? If it has been fixed I would like to keep 1.6.

    Also... is there an updater planned to address this or are we responsible for finding this JVM on our own and pointing to it? I am assuming it is up to us since its a JVM issue but I thought I would ask...
  • 18 Sean Corfield // Feb 28, 2008 at 11:57 AM

    @Drew, there is currently no supported version of Java 6 that fixes this bug, i.e., Adobe states which version of Java 6 they support for ColdFusion 8 but the bug is fixed in some later version of Java 6 (so they can't officially offer support for a version that wasn't available when they certified CF8).
  • 19 Constantine Vu // Apr 19, 2008 at 7:43 AM

    Has anyone noticed performance improvement claimed by Adobe with CF8?

    I tried CF 8 with both jre 5 and jre 6 and noticed no performance improvement at all in comparison with CF7. Or did anythings missing in my CF8 installation ....?
  • 20 Sean Corfield // Apr 19, 2008 at 8:45 AM

    @Constantine, I've noticed huge performance boosts with CF8 and so has almost everyone I know - and Mike Brunt of Alagad has confirmed this with his benchmarking. Sounds like you have something unusual in your setup.
  • 21 Constantine Vu // Apr 19, 2008 at 5:07 PM

    @Sean, what could be wrong in the my CF8 setup? does anyone know? I installed CF8 in a Window 2003 server, IIS 6, SQL server 2005, tried CF8 both with jre6 and jre5 and see no performance boosts....
  • 22 Sean Corfield // Apr 20, 2008 at 2:39 PM

    @Constantine, without access to your code and your server, it's impossible to say.
  • 23 Kris Jones // May 1, 2008 at 5:46 PM

    We are running the same setup as Constantine (Window 2k3, IIS6, MSSQL 2k5 and 2k), and have also seen a marked slow-down side-by-side on CF8 when compared with a CF7 installation. We have down-graded the JRE which helped some, but it is still slower than on CF7. And, our application barely uses any components at all. It is very SQL heavy though - could this be a JDBC issue?
  • 24 robi sen // May 12, 2008 at 11:01 AM

    Sean,

    There are a number of Bugs in 1.6 that I have run into that seemed to be resolved in 1.6.0_06. I wonder if you could confirm that it resolves this issue for me since it seems to have for me but I dont have time to test on multiple machines and multiple architectures (I am using 64 bit on VISTA).

    Thanks,

    R
  • 25 Sean Corfield // May 12, 2008 at 11:59 AM

    @Robi, CF8.0.1 ships with 1.6.0_04 and that's what I'm using on some servers - and 1.5.x on others. I don't have a later version of 1.6.x to test on at the moment.
  • 26 DaveL // Jul 22, 2008 at 3:21 PM

    Hi Sean,

    Im new to FB5, im also getting endless compile, ive spent a few days trying to find where im going wrong but ive had no joy. Im not sure if im doing something wrong or its the jre (1.6.0_06) that im using on CF8 (win platform).

    Do you know if bug has been fixed in version 1.6.0_06 or do i need to install 1.5?

    Thanks Dl.
  • 27 Sean Corfield // Jul 22, 2008 at 4:05 PM

    @DaveL, Sun has not yet fixed the bug (it is scheduled to be fix in the 0_10 revision of Java 1.6). You might find your problem goes away if you install Java 1.5 and make ColdFusion use that.
  • 28 Hussein // Oct 29, 2008 at 11:22 AM

    A fix appears to be out now. JDK 6 update 10.

    http://java.sun.com/javase/downloads/?intcmp=1281

    I am quite eager to know what others are experiencing with this recent release from sun, in a production environment.

  • 29 Sean Corfield // Jan 14, 2009 at 6:36 PM

    @all, I have updated this blog post to reflect the availability of Java 6 Update 11 which I have tested with CF8 (even tho' it is not officially supported by Adobe).
  • 30 James Holmes // Jan 14, 2009 at 8:18 PM

    My guess is that the SSL problem with the JRun Webserver is still present in Java 6 Update 11 - this is a deal breaker for us and it's keeping us on Java 1.5
  • 31 Sean Corfield // Jan 14, 2009 at 11:11 PM

    @James, could you elaborate? I have not heard of that sort of problem...
  • 32 Jeffry Houser // Jan 15, 2009 at 6:05 AM


    How timely to my own development adventures; as I just updated because of the slow load times of Model Glue. This was my exact error:

    http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54742

    Even after the update to Java 6 Updater 11; I'm still having insanely slow times on the first load of a Model Glue app. I set the timeout w/ a cfsetting tag to four minutes and it appears to have addressed the issue.

    After the first load things appear to run quite smoothly.

    This update does change the HTML generated from the cfmenu tag; however I suspect that will only affect people if they are using cfmenu with a lot of custom styling (I was).
  • 33 Sean Corfield // Jan 15, 2009 at 9:11 AM

    @Jeffry, have you made sure to turn OFF Report Execution Times in the CF Admin and also looked at the Server Monitor to ensure you don't have any of the monitoring / profiling enabled?
  • 34 JP Revel // Mar 11, 2009 at 8:34 AM

    Hi Sean,

    I'm wondering if this JVM issue is affecting me. I'm running OS X 10.5.6, with CF8 with JRun as my development system, and am running fusebox 5.5. I have a fusebox app that times out in the fuseboxAction.cfc. The error specifically is a timeout on CFLOOP.

    It looks like I'm still running 1.5.0_16-133 of JVM. Am I barking up the wrong tree here?

    Thanks putting your mind to this!
    JP
  • 35 Sean Corfield // Mar 11, 2009 at 12:09 PM

    @JP, make sure Report Execution Times is OFF in the CF Admin and that Memory Tracking is OFF in the Server Monitor (and Profiling is OFF as well, although the overhead from that is not so great).

    Also in Terminal, run java -version to confirm the default JVM in use and look in the CF Admin under Server Settings > Settings Summary to confirm CF8 is using the right JVM.

    If all of those look good, I'd ask: how many circuits / fuseactions are there in your app and are you using XML (which loads all the circuits at startup)?
  • 36 Steve // Apr 6, 2009 at 1:02 AM

    I tried updating CF Administrator (Developer) as described above and the jvm.config file was successfully updated to the java 1.6._11 directory. However.... the Windows Service for Coldfusion Application is still pointing to the old java directory. Result = Coldfusion is unable to start. Am I missing something here?

    I have tried rebooting... no difference. If i restore the jvm.confik.bak file, I have Coldfusion but with the original java settings.

    Any ideas? Thanks.
  • 37 dirk // Sep 3, 2009 at 8:05 AM

    I have the same problem. Do you find a solution?
    Thanx
  • 38 James Holmes // Sep 3, 2009 at 9:32 PM

    Sorry I didn't see your reply sooner Sean. The SSL problem with JWS on Java 6 is discussed here:

    http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55448#300636
  • 39 Jim // Nov 3, 2009 at 11:58 AM

    We just upgraded from CF7 to CF8.0.0, and it's noticable that our pages are loading slower. Checking the Admin info:
    Java Version: 1.6.0_01.

    From what I read on this blog I need to get JVM 1.6.0_10. When I go to Sun to download it the current version is 1.6.0_16.

    Is it safe to get the current version to run with CF8?
  • 40 Sean Corfield // Nov 3, 2009 at 12:08 PM

    @Jim, not sure how you define "safe" but I would upgrade to Java 6 u16 and test everything to see how it runs.
  • 41 Jim // Nov 4, 2009 at 6:23 AM

    Sean,

    I've tried installing and pointing to the JRE_17 and tried it also installing and pointing to JDK_16.

    In both attempts the CF8 service would not start. The coldfusion_out.log error is [no known VMS - check for corrupt jvm.cfg]

    I changed the java.home path in the jvm.config and the wsconfig_jvm.config files. Is there something else I need to do?

    Thanks, Jim
  • 42 Sean Corfield // Nov 4, 2009 at 8:42 AM

    @Jim, you don't say whether you are on Windows, Mac or Linux...
  • 43 Jim // Nov 4, 2009 at 11:16 AM

    Sean,

    I got the new jvm in place. When I was manually editing the jvm.config file I replaced the line.
    java.home=C:/ColdFusion8/runtime/jre WITH
    java.home=C:/Program Files/Java/jdk1.6.0_17/jre

    The CF8 Service won't start.
    I used the JVM update (Browse) in the CF8 Adminstrator and it created the following line in the jvm.config file:
    java.home=C:\\Program Files\\Java\\jdk1.6.0_17\\jre

    CF8 service starts. Hopefully this info will save someone a few hours of head scratching.

    Thanks for your help.

    Jim
  • 44 Mat Evans // Nov 26, 2009 at 3:38 AM

    Hi,

    I've just updated a new server we have to 1.6.0_17 try and get round some VERY slow MG startup & running times. It seems to now crash windows2008 after about 5 mins.

    Gonna revert back to the normal jre for the time being and see if that helps. Seem to be getting some very strange running times on what is a very simple MG app - on another server we have it's running very quick - sub 100ms even with reload on so there seems to be a problem with our new servers config.

    I'll post back anything I come across with regards to jdk 1.6.0_17.

    Oh the joys of moving servers
  • 45 Sean Corfield // Nov 26, 2009 at 8:34 AM

    @Mat, check you don't have anything enabled in the Server Monitor, also check you don't have Report Execution Times enabled. Both of those can kill CFC performance.
  • 46 Sean Tindale // Jan 13, 2010 at 1:10 PM

    Thanks for this interesting blog post. I am currently facing some ColdFusion 8 / Java issues. I am periodically getting java.lang.OutOfMemoryError : Java heap space errors on my server when a client application calls a server webservice.

    I am running...

    VMWare Guest with 2GB of RAM
    Windows Server 2003
    jdk1.5.0_15

    I do not have access to the source code for this ColdFusion application. I have turned off Report Execution Times and there is no server monitoring.

    I am thinking about increasing the VM ram to 4GB and upgrading the JDK to 6 update 18. Id also like to adjust some of the java.args in the jvm.config file. I was wondering what java args other users of ColdFusion 8 where using with Java 6?

    (heap space, perm size etc...)

    I thought this might be useful to know if people are making changes to the ColdFusion JVM.

    Thanks in advance for any feedback.

    Sean
  • 47 Dean Bunting // Apr 13, 2010 at 1:00 PM

    Hi Sean,

    I've upgraded to 1.6.0_18, and all seems to be running well -- except Verity.

    Any CF tags involving Verity or even attempting to access "Verity Collections" through the admin result in a "Could not initialize class com.verity.security.k2.K2Encrypt" error.

    Tried Steve Erat's Cryptix fix (http://www.talkingtree.com/blog/index.cfm/2006/12/13/CFMX7-Verity-Java6), but that didn't help. Any idea what Adobe might have changed to the JRE shipping with CF8?

    Thanks,

    Dean
  • 48 Sean Corfield // Apr 13, 2010 at 1:06 PM

    @Dean, sorry, not a clue. I've never used Verity and I haven't been running CF8 for a long time.
  • 49 Lovetech // Jun 9, 2010 at 12:41 PM

    I just upgraded from CFMX 6.1 to CF 8.01. The upgrade was easy and got the code running in a few days.
    However, the code was running very, very slow on CF8: Simple pages took 45 seconds to load. After 3 days of searching on Internet for a solution, nothing worked. The update to Java 1.6.0_20 reduced the 45 seconds to 40 seconds, still not acceptable.
    I finally found the problem: the update did not correctly update the IIS ISAPI filters and kept the "old" CFMX 6.1 link.
    Solution:
    - Start the IIS Services Manager
    - Right click on the Default web site and choose properties.
    - Select the ISAPI Filters tab.
    Select the JRUN Connector and click on Edit
    Type (or browse to) C:\ColdFusion8\runtime\lib\wsconfig\jrunwin32.dll (or wherever your CF8 installation is) and click Apply
    - Restart the www service
    Hope this helps others to fix this very nasty Adobe bug.