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]