The amazing adventures of Doug Hughes

I am sitting here working through an application that makes use of the new ColdFusion 9 ORM capabilities. I have a simple business object that I created using EntityNew(), then populated it, and attempted to save it using EntitySave(). Nothing fancy and everything straight out of the docs.
The problem was, when I ran this code I would just get a blank screen no errors, nothing. I started up my application server Tomcat in the console and checked the output as I ran the script. Sure enough, there was a slew of Java errors being displayed with the first being

java.lang.NoClassDefFound: javax/transaction/Synchronization

With a bit of googling, I came across a blog article by Rupesh Kumar which mentioned this issue in the comments. I had heard that Tomcat was not officially supported by ColdFusion which did not make a lot of sense, but apparently this just came back and bit me.

Somewhere in the Hibernate integration with ColdFusion 9, it is expecting a library called jta.jar (part of the Java Transaction support) to be included with the application server. This library is not included by default with Tomcat and thus the error I was seeing, or not seeing.
I did some searching and could not find the jta.jar library to download, but I did find a zip download of all of the classes available on the Java site at http://java.sun.com/javaee/technologies/jta/index.jsp. So, I simply downloaded this and renamed it to jta.jar, then dropped it into my Tomcat /lib folder. With that in place, I restarted Tomcat, fired up my CF template again and everything worked like it should.

I cant fault Adobe since they dont support Tomcat. I am curious as to why they dont support it since it used to be supported, but hopefully this will save somebody a couple of hours digging around when their script fails to show anything.

Comments on: "ColdFusion 9 ORM on Tomcat Gotcha" (4)

  1. Thanks for the hint, I find it odd they do not support Tomcat as well.

    So no Tomcat support, discontinuing JRun development… Sounds like a plan!

    Like

  2. The root cause of this is that Tomcat is a JEE web container, while all the CF-supported platforms are JEE application servers. App servers must contain a web container, along with numerous other pieces, one of which is JTA. Since Tomcat isn’t an app server, it doesn’t include JTA, so you have to provide it yourself.

    Aside from Hibernate, I can’t think of any CF features that required more than a web container to run, which is why Tomcat has never been a problem (for you or anyone else). CF is, after all, a web app, not an enterprise app. Fortunately, you can manually add pretty much any app server-required functionality to a web container by dropping JAR, so I’d imagine Tomcat will still be a widely used platform for CF.

    Like

  3. Hi Jeff, as an alternative, as Joe Rinehart mentions (http://www.firemoss.com/index.cfm/2009/10/20/Creating-a-ColdFusion-9–Tomcat-Environment-in-Eclipse), you can also just download Hibernate to find that jta.jar.

    Like

  4. In addition to the Hibernate download having that jar, you can also get it here: http://www.oracle.com/technetwork/java/javaee/jta/index.html

    Thanks for this post. It’s exactly what I needed right now.

    Like

Comments are closed.

Tag Cloud

%d bloggers like this: