You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Michael Oliver <ol...@sourceonenet.com> on 2005/05/20 19:49:01 UTC

Log4JLogger does not implement Log

I have created an ant task as follows:

 

<path id="compile.classpath">

    <pathelement path ="${webinf.dir}/lib/commons-beanutils.jar"/>

    <pathelement path ="${webinf.dir}/lib/commons-digester.jar"/>

    <pathelement path ="${webinf.dir}/lib/commons-logging.jar"/>

    <pathelement path ="${webinf.dir}/lib/AJContentClient.jar"/>

    <pathelement path ="${webinf.dir}/lib/AJRegistries.jar"/>

    <pathelement path ="${webinf.dir}/lib/AlariusESB.jar"/>

    <pathelement path ="${webinf.dir}/lib/log4j-1.2.8.jar"/>

    <pathelement path ="${webinf.dir}/lib/junit.jar"/>

    <pathelement path ="${webinf.dir}/lib/struts.jar"/>

    <pathelement path = "${webinf.dir}/lib/standard.jar"/>

    <pathelement path ="${webinf.dir}/classes"/>

    <pathelement path ="${classpath.external}"/>

    <pathelement path ="${classpath}"/>

</path>

 

<target name="axis-java2wsdl">

<echo message="Building wsdl for ${project.distname} at
${local.wsdl}}"/>

      

  <axis-java2wsdl 

 
classname="com.alarius.assignments.actions.SaveAssignmentForm"

      style= "DOCUMENT"

      namespace= "urn:http://alariussystemsllc.com/AJCCWebService/"

      location= "http://localhost:8080/AlariusAssignments/services/"

      output="AlariusAssignments.wsdl" >

      <classpath>

            <pathelement path ="${webinf.dir}/classes"/>

      </classpath>

      <classpath refid="compile.classpath"/>

                        

  </axis-java2wsdl >

</target>

 

commons-logging and log4j are in the compile.classpath

 

When I run this target I get

 

axis-java2wsdl:

     [echo] Building wsdl for AlariusAssignments at
C:\Java\ArchivedWorkspaces\AlariusAssignments\AlariusAssignments.wsdl}

[axis-java2wsdl] Java2WSDL
com.alarius.assignments.actions.SaveAssignmentForm

[axis-java2wsdl] java.lang.ExceptionInInitializerError

[axis-java2wsdl] at java.lang.Class.forName0(Native Method)

...

[axis-java2wsdl] Caused by:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log

[axis-java2wsdl] at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:532)...

 

So researching this I find that the "Log4JLogger does not implement Log"
is caused by a classloader problem.

 

So I found in the eclipse ant runtime preferences Global Entries, both
the commons-logging and log4j jars.  So I removed them from there and
ran ant on that target again...

 

axis-java2wsdl:

     [echo] Building wsdl for AlariusAssignments at
C:\Java\ArchivedWorkspaces\AlariusAssignments\AlariusAssignments.wsdl}

[axis-java2wsdl] java.lang.NoClassDefFoundError:
org.apache.commons.logging.LogFactory

[axis-java2wsdl] at
org.apache.axis.components.logger.LogFactory.class$(LogFactory.java:84)

...

 

Huh???

 

If the ant runtime is loading the commons-logging and log4j jars and
that causes a classloader sequence problem, then removing them from
there and leaving the ones in the compile.classpath should NOT cause a
NoClassDefFoundError.

 

How can it be that one way it doesn't find LogFactory and the other way
it has a classloader sequence problem?

 

Conversely if ant needs to load them and the ant axis task also needs to
load them, how do I ensure they are loaded in the proper sequence to
avoid the conflict?

 

Michael Oliver

CTO

Alarius Systems LLC

6800 E. Lake Mead Blvd, #1096

Las Vegas, NV 89156

Phone:(702)643-7425

Fax:(702)974-0341

*Note new email changed from oliverm@matrix-media.com

 

 

 

 


Re: Log4JLogger does not implement Log

Posted by Simon Kitching <sk...@apache.org>.
On Fri, 2005-05-20 at 10:49 -0700, Michael Oliver wrote:
> When I run this target I get
> 
>  
> 
> [axis-java2wsdl] Caused by:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException: Class
> org.apache.commons.logging.impl.Log4JLogger does not implement Log
> 
> [axis-java2wsdl] at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
> l.java:532)...
> 
>  
> 
> So researching this I find that the "Log4JLogger does not implement Log"
> is caused by a classloader problem.
> 
>  
> 
> So I found in the eclipse ant runtime preferences Global Entries, both
> the commons-logging and log4j jars.  So I removed them from there and
> ran ant on that target again...
> 
>  
> 
> axis-java2wsdl:
> 
>      [echo] Building wsdl for AlariusAssignments at
> C:\Java\ArchivedWorkspaces\AlariusAssignments\AlariusAssignments.wsdl}
> 
> [axis-java2wsdl] java.lang.NoClassDefFoundError:
> org.apache.commons.logging.LogFactory
> 
> [axis-java2wsdl] at
> org.apache.axis.components.logger.LogFactory.class$(LogFactory.java:84)
> 
> ...
> 
>  
> 
> Huh???
> 
>  
> 
> If the ant runtime is loading the commons-logging and log4j jars and
> that causes a classloader sequence problem, then removing them from
> there and leaving the ones in the compile.classpath should NOT cause a
> NoClassDefFoundError.
> 
>  
> 
> How can it be that one way it doesn't find LogFactory and the other way
> it has a classloader sequence problem?

This problem is caused when you have *all* of the following true:
 * child-first classloading order selected in child classloader
 * code in child classloader that calls JCL
 * commons-logging.jar available via child classloader
 * code in shared classloader that calls JCL
 * commons-logging.jar available via shared classloader

Because you have code in the shared classloader that calls JCL, you
*must* deploy commons-logging.jar at the shared level.

So the simplest fix is to delete the commons-logging.jar from the child
classloader. The downside of this is that all your logging config then
becomes "global", ie you need to configure logging using a config file
at the shared level, and webapps share the same logging instance. But I
don't think you really care about logging in this case do you?


Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


RE: Log4JLogger does not implement Log

Posted by Michael Oliver <ol...@sourceonenet.com>.
Thanks, will try the <java> task with fork and let the list know.

Michael Oliver
CTO
Alarius Systems LLC
6800 E. Lake Mead Blvd, #1096
Las Vegas, NV 89156
Phone:(702)643-7425
Fax:(702)974-0341
*Note new email changed from oliverm@matrix-media.com

-----Original Message-----
From: Mattias J [mailto:mattias.jiderhamn@expertsystem.se] 
Sent: Saturday, May 21, 2005 12:37 AM
To: Jakarta Commons Users List
Subject: Re: Log4JLogger does not implement Log

At 2005-05-20 19:49, you wrote:
>...
>   <axis-java2wsdl
>
>
>classname="com.alarius.assignments.actions.SaveAssignmentForm"
>
>       style= "DOCUMENT"
>
>       namespace= "urn:http://alariussystemsllc.com/AJCCWebService/"
>
>       location= "http://localhost:8080/AlariusAssignments/services/"
>
>       output="AlariusAssignments.wsdl" >
>
>       <classpath>
>
>             <pathelement path ="${webinf.dir}/classes"/>
>
>       </classpath>
>
>       <classpath refid="compile.classpath"/>
>
>   </axis-java2wsdl >
>
></target>
>
>...
>
>[axis-java2wsdl] Caused by:
>org.apache.commons.logging.LogConfigurationException:
>org.apache.commons.logging.LogConfigurationException:
>org.apache.commons.logging.LogConfigurationException: Class
>org.apache.commons.logging.impl.Log4JLogger does not implement Log

This is why lots of people hate Commons Logging (see 
http://www.qos.ch/logging/classloader.jsp and 
http://www.qos.ch/logging/thinkAgain.jsp).

Without knowing the details of your classpath, using fork migh help.
Don't 
remember whether there is a fork-attribute on the axis-java2wsdl task;
if 
not try an ordinary "java" task with fork.

   / Mattias J 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Log4JLogger does not implement Log

Posted by Mattias J <ma...@expertsystem.se>.
At 2005-05-20 19:49, you wrote:
>...
>   <axis-java2wsdl
>
>
>classname="com.alarius.assignments.actions.SaveAssignmentForm"
>
>       style= "DOCUMENT"
>
>       namespace= "urn:http://alariussystemsllc.com/AJCCWebService/"
>
>       location= "http://localhost:8080/AlariusAssignments/services/"
>
>       output="AlariusAssignments.wsdl" >
>
>       <classpath>
>
>             <pathelement path ="${webinf.dir}/classes"/>
>
>       </classpath>
>
>       <classpath refid="compile.classpath"/>
>
>   </axis-java2wsdl >
>
></target>
>
>...
>
>[axis-java2wsdl] Caused by:
>org.apache.commons.logging.LogConfigurationException:
>org.apache.commons.logging.LogConfigurationException:
>org.apache.commons.logging.LogConfigurationException: Class
>org.apache.commons.logging.impl.Log4JLogger does not implement Log

This is why lots of people hate Commons Logging (see 
http://www.qos.ch/logging/classloader.jsp and 
http://www.qos.ch/logging/thinkAgain.jsp).

Without knowing the details of your classpath, using fork migh help. Don't 
remember whether there is a fork-attribute on the axis-java2wsdl task; if 
not try an ordinary "java" task with fork.

   / Mattias J 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org