Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with CF

Status
Not open for further replies.

NatalieGr

Programmer
Jun 19, 2006
1
UA
Hi, All

I have problem, hope someone can help with with it.

I have Macromedia Coldfusion 7.0 installed with the server configuration and Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04).

My task was to create the CF sample that talks to some web-service. The CF is not support the Digest Authentication, so I've created Java class that connects to the web-service, does Digest Authentitication and invokes web-service methods.
I used CF's WSDL2Java tool to generate classes that talking to service and Axis libraries that I found in CF/lib and runtime/lib folders.

I can debug and take the web-service results in the NetBeansIDE 5.0 (using the same java platform that CF uses and the same Axis libraries).

So, the problem appears when I try to create Java class object in CF and run the class method.
Here is CF code

<cfobject action="create" type="java" class="serviceclient.test" name="obj">
<cfset ret=obj.init()>
<cfset traffic=ret.doit()>
<cfoutput>#traffic#</cfoutput>

I'm getting org.apache.commons.logging.LogConfigurationException: java.lang.ClassCastException

Here is the full exception description

[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 net.advection.servicemanager.BandwidthLocator.<init>(BandwidthLocator.java:10)
at service.qq.doit(qq.java:40)
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 cfservice2ecfm80614500.runPage(C:\CFusionMX7\at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:210)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.lang.ClassCastException
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:554)
... 39 more
[0]java.lang.ExceptionInInitializerError
at org.apache.axis.client.Service.getAxisClient(Service.java:143)
at org.apache.axis.client.Service.<init>(Service.java:152)
at net.advection.servicemanager.BandwidthLocator.<init>(BandwidthLocator.java:10)
at service.qq.doit(qq.java:40)
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 cfservice2ecfm80614500.runPage(C:\CFusionMX7\at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:210)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: 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)
... 35 more
Caused by: java.lang.ClassCastException
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:554)
_

I did not find anything usefull about this exception and I can't finish my task.

Please advice.

Regards,
Natalie
 
Hi Natalie,

Are you using log4j in your Java objects? If so, I'll bet that it is a 'much' newer version than the one mx7 uses, and since your classes are loaded later in the chain on the class loader, your code will attempt to use the old library CF uses. Attempting to load your classes before CF in the
jvm is of no use as they use depreciated method calls.

I think that you will have to create a custom class loader to include your version of log4j, or commons logging.

The person who runs CompoundTheory created a slick classloader.cfc, check it out:
Hope this helps,

Justin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top