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]
--
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand
[EMAIL PROTECTED]
Ph +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]