You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mike Brown <br...@satx.rr.com> on 2002/03/21 23:41:49 UTC

ClassCastException in commons logging

I have two applications that are running under tomcat that communicate using methods exposed as axis web services.
The service method is identical for each service and looks like:

public void processMessage(String message)

Thus when A wants to communicate with B it invokes B's processMessage service method with a parameter that happens to be an XML formatted string.

This all works good except for one condition ... when A calls B's processMessage method and in that method B calls A's processMessage method, I get the following exception:

java.lang.ClassCastException: org.apache.commons.logging.impl.LogFactoryImpl
        at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:504)
        at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:400)
        at org.apache.axis.message.MessageElement.<clinit>(Unknown Source)
        at org.apache.axis.client.Call.invoke(Unknown Source)
        at org.apache.axis.client.Call.invoke(Unknown Source)
        at org.apache.axis.client.Call.invokeOneWay(Unknown Source)

Any ideas???

Mike

Re: ClassCastException in commons logging

Posted by Mike Brown <br...@satx.rr.com>.
Adam,  I tried about everything ... I finally downloaded the latest nightly build of commons-logging.jar and it fixed the problem.  I still have other problems, but at least logging code is not throwing exceptions on me!

Thanks for your reply!

Mike
  ----- Original Message ----- 
  From: ajack 
  To: axis-user@xml.apache.org 
  Sent: Thursday, March 21, 2002 5:18 PM
  Subject: RE: ClassCastException in commons logging


  I messed around w/ this problem for a few hours, and since it was so painful I can't recall 100% exactly what fixed it. It might be that log4j wasn't loaded for that app [class not found caught & null returned, null giving class cast...], or that a log4j was not configured right [odd, I thought it failed safe, but seems true], or that you needed commons-logging.properties with org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory or that a bad commons-logging.jar was shipped in the webapp/WEB-INF/lib directory. My guess would be one of the former, but I pretty much tried all.

  Why it happens in one direction I do not know, if it is one server [not two] but I've seen some folk here talk about TC classloader issues that go over my head. If two --- environment.

  regards

  Adam
  -----Original Message-----
  From: Mike Brown [mailto:brownstone@satx.rr.com]
  Sent: Thursday, March 21, 2002 3:42 PM
  To: axis-user@xml.apache.org
  Subject: ClassCastException in commons logging


    I have two applications that are running under tomcat that communicate using methods exposed as axis web services.
    The service method is identical for each service and looks like:

    public void processMessage(String message)

    Thus when A wants to communicate with B it invokes B's processMessage service method with a parameter that happens to be an XML formatted string.

    This all works good except for one condition ... when A calls B's processMessage method and in that method B calls A's processMessage method, I get the following exception:

    java.lang.ClassCastException: org.apache.commons.logging.impl.LogFactoryImpl
            at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:504)
            at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350)
            at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:400)
            at org.apache.axis.message.MessageElement.<clinit>(Unknown Source)
            at org.apache.axis.client.Call.invoke(Unknown Source)
            at org.apache.axis.client.Call.invoke(Unknown Source)
            at org.apache.axis.client.Call.invokeOneWay(Unknown Source)

    Any ideas???

    Mike

RE: ClassCastException in commons logging

Posted by ajack <aj...@openbiz.biz>.
I messed around w/ this problem for a few hours, and since it was so painful
I can't recall 100% exactly what fixed it. It might be that log4j wasn't
loaded for that app [class not found caught & null returned, null giving
class cast...], or that a log4j was not configured right [odd, I thought it
failed safe, but seems true], or that you needed commons-logging.properties
with
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
actory or that a bad commons-logging.jar was shipped in the
webapp/WEB-INF/lib directory. My guess would be one of the former, but I
pretty much tried all.

Why it happens in one direction I do not know, if it is one server [not two]
but I've seen some folk here talk about TC classloader issues that go over
my head. If two --- environment.

regards

Adam
-----Original Message-----
From: Mike Brown [mailto:brownstone@satx.rr.com]
Sent: Thursday, March 21, 2002 3:42 PM
To: axis-user@xml.apache.org
Subject: ClassCastException in commons logging


  I have two applications that are running under tomcat that communicate
using methods exposed as axis web services.
  The service method is identical for each service and looks like:

  public void processMessage(String message)

  Thus when A wants to communicate with B it invokes B's processMessage
service method with a parameter that happens to be an XML formatted string.

  This all works good except for one condition ... when A calls B's
processMessage method and in that method B calls A's processMessage method,
I get the following exception:

  java.lang.ClassCastException:
org.apache.commons.logging.impl.LogFactoryImpl
          at
org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:504)
          at
org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350)
          at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:400)
          at org.apache.axis.message.MessageElement.<clinit>(Unknown Source)
          at org.apache.axis.client.Call.invoke(Unknown Source)
          at org.apache.axis.client.Call.invoke(Unknown Source)
          at org.apache.axis.client.Call.invokeOneWay(Unknown Source)

  Any ideas???

  Mike