Hi Ants,

thank you for your help, but our classloading problems don't think to be so 
similar, because the classes i am trying to load are for sure not in 
WEB-INF/lib. This classes are part of an third party sofware.

This Third-Party software is using their own old version of xerces and cocoon, 
so i am loading them into the aar, so that the Axis2-Xerces is not getting 
mixed with the old one of the Third-Party libraries.

The mysterious thing now is that i put all the third party jars in my 
service's lib directory (without nested jars) and every workaround of loading 
one of the classes of this jar through one of the possible Classloader isn't 
working. But instantiation of this classes directly in my Service 
implementation class is possible, just not classloading.

As far as my small know-how about Axis2 goes, the service has his own 
classloader and in the deployment phase it loads with this exactly 
classloader the service's libraries under the service's lib directory.

*frustating*

Periklis


On Sunday 19 August 2007, Anthony Bull wrote:
> Hi Periklis,
>
> I had a lot of similar classpath issues with Axis 2 1.2 recently and
> managed to sort them out.  I tried all the tricks like exploding the
> .aar file, but in the end none of it was necessary.
>
> My .aar file is the same structure as yours - and I'm using the
> following to load my log4j.properties using the service classloader:
>
> ServiceSkeleton.class.getClassLoader().getResourceAsStream(
> "log4j.properties");
>
> This picks up the class file from the root of my .aar file, fine.
>
> The main thing that was causing me problems was that some of the classes
> I was trying to load (e.g. Log4j.jar in particular) were also in jars or
> the classes area of the main axis2/WEB-INF area as well as being in the
> .aar files.  Axis 2 was picking them up before looking in my .aar files
> and then loading them with a different classloader - hence my service
> wouldn't load them, but it would still get Class Def Not Found errors.
> Simply clearing these jars out of the axis2/WEB-INF/lib folder fixed
> this all up for me.
>
> cheers,
> Ants.
>
> Periklis Tsirakidis wrote:
> > I noticed that my topic is referring to Axis 1.3, but i meant Axis2 1.3.
> >
> > Periklis
> >
> > Periklis Tsirakidis wrote:
> >> Hi again,
> >>
> >> after couple of different packaging experiments and still not working
> >> solution, i stepped in a weird situation.
> >>
> >> My Service now has the following structure:
> >>
> >> myservice.aar
> >> -- META-INF
> >> ---- service.xml
> >> -- lib
> >> ---- lib1.jar
> >> ---- lib2.jar
> >> ---- lib3.jar
> >> ---- lib4.jar
> >> -- com
> >> ---- ....my classes here incl. the service impl class
> >>
> >> The weird situation now is, that if try to load a class included in com
> >> inside my service implementation class, with following code, i get still
> >> a ClassNotFoundException.
> >>
> >>> ClassLoader loader = getClass().getClassLoader();
> >>>
> >>> Class myclass = Class.forName('classname', true, loader);
> >>
> >> or even with
> >>
> >>> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> >>>
> >>> AxisService serviceHandler = msgCtx.getAxisService();
> >>>
> >>> ClassLoader serviceLoader = serviceHandler.getClassLoader();
> >>>
> >>> //Class serviceClass = serviceLoader.loadClass(service);
> >>>
> >>> Class serviceClass = Class.forName(service, true, serviceLoader);
> >>>
> >>> MyClass srv = (MyClass) serviceClass.newInstance();
> >>
> >> still ClassNotFoundException.
> >>
> >> If i import the class and instatiate it, then everything works fine.
> >>
> >> The Class i am trying to load with the Classloader doesn't use any class
> >> from the jars included in the lib directory.
> >>
> >> I tried also all the workarounds above with an unpacked aar.
> >>
> >> Anybody an idea?
> >>
> >> Periklis
> >>
> >> Periklis Tsirakidis wrote:
> >>> Hi,
> >>>
> >>> i am currently working on a service, that is deployed in a service
> >>> archive, as described in the documentation. This service needs access
> >>> on a library which is located under WEB-INF/lib, due to further usage
> >>> of this library out of my service.
> >>>
> >>> I am using axis 1.3 deployed as a war on a Tomcat 5.5.12.
> >>>
> >>> The jar structure of mylib.jar is:
> >>> mylib.jar
> >>> -- META-INF
> >>> ---- MANIFEST.MF
> >>> -- lib
> >>> --- ...couple of libs here
> >>> -- com
> >>> ---- ...classes in package hierarchy
> >>>
> >>> My service archive myservice.aar is located in the WEB-INF/services and
> >>> i have hotupdate in my axis2.xml configuration enabled.
> >>>
> >>> The code i am trying to access classes from the jar file in my service
> >>>
> >>> implementation class is following:
> >>>> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> >>>>
> >>>> AxisService serviceHandler = msgCtx.getAxisService();
> >>>>
> >>>> ClassLoader serviceLoader = serviceHandler.getClassLoader();
> >>>>
> >>>> //Class serviceClass = serviceLoader.loadClass(service);
> >>>>
> >>>> Class serviceClass = Class.forName(service, true, serviceLoader);
> >>>>
> >>>> MyClass srv = (MyClass) serviceClass.newInstance();
> >>>
> >>> The deployment of the service is working fine, but when i call some
> >>> function of my service implementation class that itselfs needs an
> >>> instance of the mylib.jar i get a ClassNotFoundException.
> >>>
> >>> I have tried also the setOperationContext way, but as i read in the
> >>> mailing list, this way is not thread safe.
> >>>
> >>> Has anybody an idea?
> >>>
> >>> Thanks in advance.
> >>>
> >>> Periklis
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to