Re: playing outside the tomcat 4 classloaders "sandbox"
On 8/23/05, Peter Crowther <[EMAIL PROTECTED]> wrote: > > From: Fabien Benoit [mailto:[EMAIL PROTECTED] > > I'm using Tomcat (4.1) and Axis 1.2 to provide a web service interface > > to a classical 2-tier application. My problem is, I need to access the > > existing API of this application, a single jar located outside the > > tomcat install. Copying this jar inside tomcat commmon lib dir or > > webapp lib dir is not permitted. > > Since tomcat gets rid of the system classpath > > ... But you can put it back by modifying catalina.{bat,sh} depending on > platform, which will be more robust than relying on a classloader. I agree, but it seems that the classpath is overrided by some hidden mecanism inside bootstrap.jar itself, not by the script? Do you mean doing smething like "java -classpath %CLASSPATH% -jar bootstrap.jar" ? Thanks Fabien - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: playing outside the tomcat 4 classloaders "sandbox"
> From: Fabien Benoit [mailto:[EMAIL PROTECTED] > I'm using Tomcat (4.1) and Axis 1.2 to provide a web service interface > to a classical 2-tier application. My problem is, I need to access the > existing API of this application, a single jar located outside the > tomcat install. Copying this jar inside tomcat commmon lib dir or > webapp lib dir is not permitted. > Since tomcat gets rid of the system classpath ... But you can put it back by modifying catalina.{bat,sh} depending on platform, which will be more robust than relying on a classloader. If you have a constraint that you're *also* not allowed to touch the Tomcat startup files, then I would feed back that the combination of these constraints will make any eventual solution *less* robust rather than the intention behind the constraints of making more robust systems. - Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
playing outside the tomcat 4 classloaders "sandbox"
Hi everyone. I'm using Tomcat (4.1) and Axis 1.2 to provide a web service interface to a classical 2-tier application. My problem is, I need to access the existing API of this application, a single jar located outside the tomcat install. Copying this jar inside tomcat commmon lib dir or webapp lib dir is not permitted. Since tomcat gets rid of the system classpath, my first thought was to use a custom classloader, making the WebAppClassLoader his parent, and then set the context class loader with this new classloader : Thread.currentThread().setContextClassLoader(myClassLoader); But it doesn't work. The myClassLoader.loadClass("JarUrl") works fine but I still have a NoClassDefFoundError when I try to use directly a class from the jar. Here is the code : URLClassLoader classloader = new URLClassLoader( new URL[] { new URL(classpath)} , Thread.currentThread().getContextClassLoader() ); Thread.currentThread().setContextClassLoader(classloader); classloader.loadClass("mc.mis.batch.BatchParams"); => ok, returns the good Class object mc.mis.batch.BatchParams batchParam = new mc.mis.batch.BatchParams(); => NoClassDefFoundError If someone has an other idea, or know what is wrong, I would thank him forever. Fabien - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]