Accessibility
Adobe
Sign in My orders My Adobe

Title

ColdFusion MX 7: Conflict with Apache Commons Logging libraries in third party applications throws LogConfigurationExceptionProducts affected

Issue

The exceptionorg.apache.commons.logging.LogConfigurationException: java.lang.ClassCastException may be thrown when running some third party applications.

Reason

ColdFusion MX 7 uses Apache Commons Logging version 1.0.2. Third party applications may be packaged with their own, newer version of Commons Logging. When ColdFusion starts, the ColdFusion MX classes are loaded into the classpath first. When the third party application tries to use the older ColdFusion logging libraries, ColdFusion MX throws an org.apache.commons.logging.LogConfigurationException: java.lang.ClassCastException.

The stack will look similar to the following:

10/24 12:00:48 error
[1]org.apache.commons.logging.LogConfigurationException: java.lang.ClassCastException
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:558)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:345)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:409)
at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:76)
at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:81)
at org.apache.axis.client.Service.getAxisClient(Service.java:143)
at org.apache.axis.client.Service.<init>(Service.java:152)
at com.sforce.soap.enterprise.SforceServiceLocator.<init>(SforceServiceLocator.java:10)
at com.sforce.soap.enterprise.sobject.SForceBinding.createBinding(SForceBinding.java:61)
at com.sforce.soap.enterprise.sobject.SForceBinding.init(SForceBinding.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at coldfusion.runtime.StructBean.invoke(StructBean.java:391)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1662)
at cfsfcore2ecfc647757360$funcINIT.runFunction(E:\websites\codecorrect.com\com\codecorrect\core\sfcore.cfc:122)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:348)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:258)
...

This is logged as Macromedia issue 55821.

Solution

To workaround the problem, modify the ColdFusion MX classpath. Add the location of the third party .jar(s) containing the newer version of the Apache Commons Logging utility to the front of the ColdFusion MX classpath (cf.class.path). ColdFusion MX then loads the third party application's newer Apache Common Logging libraries first, thereby avoiding the classfile conflict.

For example, if the JAR file for the application containing the newer Apache commons logging libraries resides in WEB-INF/cfusion/lib/thirdparty, the entry in the web.xml would be as follows:

 <context-param id="macromedia_context_88"><param-name>cf.class.path</param-name><param-value>./WEB-INF/cfusion/lib/thirdparty, ./WEB-INF/cfusion/lib/updates,./WEB-INF/cfusion/lib, ./WEB-INF/cfform/jars</param-value></context-param> 

Additional Information

For more information on commons logging, see http://jakarta.apache.org/commons/logging/.


Doc ID
(98b79ee8)

Last updated
2007-10-11

Products affected

Contacting Adobe Support

Still need help?
Find out about all your support options.
Contact support