I’ve had a few people contact me in the last two weeks about problems starting up their JBoss-ColdFusion installation because of errors with Apache Commons Logging. This, unfortunately, is a common problem and it’s not an easy 1-2-3 fix. The problem arises when a third-party library or application is loaded that uses a newer version of commons logging than ColdFusion does.
In Java application servers, there’s an order in which applications are deployed. In JBoss, the default is alphabetical order inside the server directory. Let’s assume you have an app called BaseballStats stored in baseball.war. Then another application, such as the JMX Console that comes with JBoss, is in jmx-console.war.
The baseball.war application is deployed first with the commons-logging.jar file in ColdFusion’s classpath (WEB-INF\cfusion\lib) which is version 1.0.2, I believe. Then the jmx-console application tries to deploy and it needs version 1.0.7 located in jboss\server\default\deploy\lib.
This type of situation leads to CLASSPATH exceptions such as –
What you need to do in situations like this is ensure that ColdFusion loads the latest version of the Apache Commons Logging library available to it before it attemtps to load the one with which it shipped. You designate this in your web.xml file. Search for the text cf.class.path in this file and ensure that the location of the latest Commons Logging library is the first entry in the classpath.
For example, if you need to use the one shipped with your version of JBoss, an sample entry would look like this. I added the path to the JBoss lib directory before the references to the ColdFusion lib directory. This ensures that it will look at JBoss first to find a library before it looks in its own collection.
<-- Comma-delimited list of classpath locations relative to app root -->
<context-param id="macromedia_context_88">
<param-name>cf.class.path</param-name>
<param-value>
../../lib,
./WEB-INF/cfusion/lib/updates,
./WEB-INF/cfusion/lib,
./WEB-INF/cfusion/gateway/lib.,
./WEB-INF/cfform/jars
</param-value>
</context-param>
8 Responses for "ColdFusion and Commons Logging Conflicts"
nice idea, but it doesn’t work in my case. commons-logging version 1.0.4 seems incompatible with cf, so war isn’t deployed :-( i’m using jboss4 defalt server and cf7.
did you make sure that the newer version of commons-logging had precedence in your class path? you should only get the error you are describing if cf is first seeing its version of commons-logging.
Like the first comment, due to the different commons-logging versions between JBoss 4.0.5 and CF MX 7.02, having CF use JBoss’s libs caused problems.
For the problem “You have more than one version of ‘org.apache.commons.logging.Log’ visible”, I discovered that WEB-INF/cfform/jars/commons-logging.jar and WEB-INF/cfusion/lib/commons-logging-1.0.2.jar contained this class.
I moved WEB-INF/cfform/jars/commons-logging.jar to WEB-INF/cfform/jars/commons-logging.save and things began working.
Working config:
—————
Linux web1 2.6.18-gentoo-r2
JBoss 4.0.5
CF MX 7.0.2
Sun JDK 1.4.2.13
Good luck all – and thank you Steve for giving me confidence this was possible – I owe you twice now! If you ever find yourself in Seattle – look me up, I’ll take care of you!
Jayson, I’m glad you got it working, and it’s more evidence that this problem doesn’t have a one size fits all solution. I’m pleased that my post got you off on the right path, and if I’m in Seattle, then I’ll definitely be very lost and have to look you up.
very nice! Thank you!!
We owe you a beer! We’ve been fighting w/ JRun, ColdFusion and Spring for DAYS.
And we had to toast the orginial commons-logging file too like the previous poster.
So this is interesting.
We also found that by removing all commons-loggings and adding 1.1 everything was happy. Does 1.1 solve all of this mess?
Hi all, I just wanted to say thanks for this from a non-J2EE expert (to put it mildly) who’s been about ready to kill someone (anyone!) trying to get JBoss and CFMX set up on my Mac. This commons-logging thing just about put me over the edge.
Tim’s tip worked for me with JBoss 4.0.5.GA and CFMX 7.0.2. I downloaded the 1.1 commons-logging file, renamed every commons-logging.jar I could find to commons-loggins.save, put the commons-logging-1.1.jar file into JBoss’s server/default/lib directory and renamed it to the original commons-logging.jar. At long last the blissful sight of the CF Admin page opening!
Thank you thank you.
Now we’ll see if I broke Flex Data Services in the meantime… It seems like there are some Flex gateway related errors as JBoss loads up….
The site looks great ! Thanks for all your help ( past, present and future !)
Leave a reply