axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brennan Spies" <brennansp...@sbcglobal.net>
Subject Re: Possible classloader issue - help needed
Date Fri, 26 Oct 2007 06:57:34 GMT
Oh yes, there is also the /lib folder in the root of the Axis2 install 
(rather than in the .aar).

----- Original Message ----- 
From: "Brennan Spies" <brennanspies@sbcglobal.net>
To: <axis-user@ws.apache.org>
Sent: Thursday, October 25, 2007 11:46 PM
Subject: Re: Possible classloader issue - help needed


> Well, here the exception is a bit more informative. Looking at the source, 
> the exception is coming from this line(s) in ConfigCatalogRule.begin():
>
>            Class clazz = 
> digester.getClassLoader().loadClass(catalogClass); 
> //ClassNotFoundException
>            catalog = (Catalog) clazz.newInstance();
>
> And from the stack trace it is clear that it is Tomcat's webapp 
> classloader that is failing to see the class. Not sure what to make of the 
> java.net.URLClassLoader@c56049 since it is probably the case that the 
> classloader is a subclass of URLClassLoader (super.toString()..?). Try 
> using the Class.getClassLoader.getClass().getName() instead.
>
> 1) Create a simple utility method that recurses up the classloading tree 
> using ClassLoader.getParent()--stop when you get a null from this method. 
> Print out the class name of each ClassLoader.
> 2) Also print out the class name of each ClassLoader for the classes of 
> interest: Digester, CatalogBase (the impl version), ConfigCatalogRule, 
> AgentPlatformServiceMessageReceiverInOut. Don't create a new instance; use 
> a static reference to the class like 
> 'ConfigCatalogRule.class.getClassLoader()'. To be thorough, you should 
> check to see if this is null before doing getClass().getName().
>
> Remember, visibility of a class only goes one direction in a classloading 
> tree: up. It may be the case that the solution might be moving the jars in 
> question to a URL that is loaded by a classloader further up the tree, 
> e.g. WEB-INF/lib.
>
> Regards,
>
> Brennan
>
> ----- Original Message ----- 
> From: "João Luís Pinto" <joaoluispinto@gmail.com>
> To: <axis-user@ws.apache.org>
> Sent: Thursday, October 25, 2007 7:09 PM
> Subject: Re: Possible classloader issue - help needed
>
>
> Hello,
>
> Here are the results:
>
> Code in the MessageReceiver:
>
> <code>
> log1.debug("Loading " + url); //$NON-NLS-1$
>
> log1.debug("AgentPlatformServiceMessageReceiverInOut: " //$NON-NLS-1$
>    + getClass().getClassLoader().toString());
>
> log1.debug("Digester: " //$NON-NLS-1$
>    + new Digester().getClass().getClassLoader().toString());
>
> log1.debug("CatalogBase: " //$NON-NLS-1$
>    + new CatalogBase().getClass()
>     .getClassLoader()
>     .toString());
>
> log1.debug("MessageReceiver CL == Digester CL? " //$NON-NLS-1$
>    + (getClass().getClassLoader() == new Digester().getClass()
>    .getClassLoader() ? "true" : "false")); //$NON-NLS-1$//$NON-NLS-2$
>
> configParser.parse(url);
> </code>
>
> Output:
>
> [DEBUG] Loading
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/chain-config.xml
> [DEBUG] AgentPlatformServiceMessageReceiverInOut: 
> java.net.URLClassLoader@c56049
> [DEBUG] Digester: java.net.URLClassLoader@c56049
> [DEBUG] CatalogBase: java.net.URLClassLoader@c56049
> [DEBUG] MessageReceiver CL == Digester CL? true
>
> As for the trace of the VM, aparently both classes from commons-chain
> and commons-digester are loaded before the exception:
>
> (...)
> [Loaded org.apache.commons.digester.RuleSetBase from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-digester-1.8.jar]
> [Loaded org.apache.commons.chain.config.ConfigRuleSet from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.commons.chain.config.ConfigCatalogRule from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.commons.chain.config.ConfigRegisterRule from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.commons.chain.config.ConfigDefineRule from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.commons.digester.RulesBase from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-digester-1.8.jar]
> [Loaded org.apache.commons.chain.CatalogFactory from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.commons.chain.impl.CatalogFactoryBase from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/services/AgentPlatformService/lib/commons-chain-1.1.jar]
> [Loaded org.apache.log4j.spi.ThrowableInformation from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/lib/log4j-1.2.14.jar]
> [Loaded org.apache.log4j.spi.VectorWriter from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/lib/log4j-1.2.14.jar]
> [Loaded org.apache.log4j.spi.NullWriter from
> file:/Users/jpinto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Axis2/WEB-INF/lib/log4j-1.2.14.jar]
> [ERROR] Begin event threw exception
> java.lang.ClassNotFoundException: 
> org.apache.commons.chain.impl.CatalogBase
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
> at 
> org.apache.commons.chain.config.ConfigCatalogRule.begin(ConfigCatalogRule.java:106)
> at org.apache.commons.digester.Digester.startElement(Digester.java:1453)
> (...)
>
> Any idea?
>
> Thanks,
>
> João
>
> On 10/25/07, Spies, Brennan <Brennan.Spies@ejgallo.com> wrote:
>> Joao,
>>
>> (I don't see where the Xerces jar is--it's not in your AAR. Can't be the 
>> Sun
>> JDK 1.5 version, because all of those are prefaced with com.sun.)
>>
>> You might try:
>>
>> 1) Run the JRE with -verbose:class option. See if your class is actually
>> getting loaded.
>>
>> 2) Get a reference to a classloader the is in your code and compare this 
>> with
>> the classloader for org.apache.commons.digester.Digester. See if they are 
>> the
>> same (using identity ==).
>>
>> This might help:
>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html. Note 
>> that
>> the web application classloaders are child-first classloaders, so classes
>> loaded by these won't be visible to parent classloaders in the tree. Not 
>> sure
>> if the Axis 2.0 classloaders are the same way.
>>
>> Hope this helps,
>>
>> Brennan Spies
>> Sr. Programmer Analyst
>> Shared Application Services
>> (209) 341-6457
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 


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


Mime
View raw message