Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
axis-java2wsdl LogFactory classloader problem

axis-java2wsdl LogFactory classloader problem

2005-05-20       - By Michael Oliver

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@(protected)










©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.