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 Periklis Tsirakidis <pe...@mayflower.de> on 2007/08/21 16:13:03 UTC

Axis2 1.3 - Classloading problem the second Try

Hi folks,

i have been trying couple of days right now with loading classes placed
in my service archive from the service implementation class, but with no
result. The funny thing is that i can instantiate this classes without
any problem.

My service's archive structure:
servicer.aar
-- com
-- META-INF
---- service.xml
-- lib
---- lib1.jar
---- lib2.jar
---- ....

Because i have tried different workarounds, i will just list them all
here and hopefully someone can help me with this issue. As i wrote on my
first e-mail the classes i am trying to load with the classloader are in
the lib/ and for sure don't exist in the WEB-INF/lib directory. Also my
archive file needs to be unpacked

My system configuration:
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32
Apache Tomcat 5.5.12
Axis2 1.3 WAR-Distribution (Default axis2.xml + Hotupdate)

So now the workarounds i have been trying:

Code 1:
>
> ClassLoader loader = getClass().getClassLoader();
>
> Class myClass = loader.loadClass('TestClassName');
>
> or
>
> Class myClass = Class.forName('TestClassName', true, loader);
>

Code 2:
>
> ClassLoader loader = ServiceClassImpl.class.getClassLoader();
>
> Class myClass = loader.loadClass('TestClassName');
>
> or
>
> Class myClass = Class.forName('TestClassName', true, loader);
>

Code 3:
>
> MessageContext messageCtx = MessageContext.getCurrentMessageContext();
>
> AxisService serviceHandler = messageCtx.getAxisService();
>
> ClassLoader loader = serviceHandler.getClassLoader();
>
> Class myClass = loader.loadClass('TestClassName');
>
> or
>
> Class myClass = Class.forName('TestClassName', true, loader);
>

Code 4 (Probably obsolete):
>
> MessageContext messageCtx = MessageContext.getCurrentMessageContext();
>
> AxisService serviceHandler = messageCtx.getAxisService();
>
> ClassLoader loader = serviceHandler.getClassLoader().getParent();
>
> Class myClass = loader.loadClass('TestClassName');
>
> or
>
> Class myClass = Class.forName('TestClassName', true, loader);
>

Code 5 (Probably dirty but still not working):
>
> ClassLoader loader = Thread.currentThread().getContextClassLoader();
>
> Class myClass = loader.loadClass('TestClassName');
>
> or
>
> Class myClass = Class.forName('TestClassName', true, loader);
>

I have tried also different environments:

Environment 1 and 2:
Apache Axis 1.3 Standalone Server
Sun JDK 1.6.0-b105 / Sun JDK 1.5.0

Environment 3 and 4:
Apache Tomcat 5.5.23
Apache Axis2 1.3 WAR-Distribution (Default axis2.xml + Hotupdate)
Sun JDK 1.6.0-b105 / Sun JDK 1.5.0

So long listing, but hopefully anybody can help me out or give me a
little bit guidance on Axis2 and classloading issues. My sources for all
the above code snippets are wso2.org, ws.apache.org/axis2 and old
mailing list archives on ws.apache.org/axis2.

Greetings

Periklis


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