Dear Users,
I am running web-services (developed in CXF) in a Tomcat 7.0.14 server, Java version "1.6.0_17", OS, Linux <hostname> 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:13 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux


Part of my service code takes a byte array and defines a class using its contents which was not previously loaded in the JVM, code snippet as follows...

Class<?> c = defineClass(name, byArray, 0, byArray.length);

This code is in a class which extends java.lang.ClassLoader.

The class represented by the byte array btArray is a class which extends a super class.

Background...
* Dynamic loading of a class this way works in the IDE (Eclipse) when not running in a Tomcat server. * The super class from which the loaded class extends is included in the war file, the files are present on the tomcat server. * When loading a class which does not extend a super class (no inheritance), the above code works fine within the service in Tomcat. * When using a class which implements an interface an interface but no inheritance, it also fails (with the following exception). * When using a class which implements an interface which is in java.io.*, e.g. Serializable, the class loads ok within the Tomcat server.

I have tried to use WebappClassloader, but cannot get the service to deploy when this class is imported from catalina.jar.

Relevant parts of the error output is pasted here...

WARNING: Application {http://peteragent.sga.org/}AgentServiceImplService#{http://peteragent.sga.org/}process has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: common/core/AbstractServiceProvider
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
[...abridgment...]
Caused by: java.lang.NoClassDefFoundError: common/core/AbstractServiceProvider
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:478)
at common.utilities.ClassLoading.FileClassLoader.loadClass(FileClassLoader.java:24)
[end]


My questions, has anyone also had this problem?
Is WebappClassLoader designed to overcome this problem?
Does anyone know why the class loads, but the JVM/ClassLoader is unable to find the super classes (although they are present). I'm aware that Tomcat uses a different ClassLoader for each webapp, but the required classes should be present in the ClassLoader of the webapp in question as they are in the war, and are in the file .../webapps/serviceName/WEB-INF/classes/ directory.


with thanks,
Peter


--
with best regards,
Peter Lavin,
PhD Candidate,
Computer Architecture & Grid Research Group,
Lloyd Institute, 005,
Trinity College Dublin, Ireland.
+353 1 8961536

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to