Can some experts answer this one for me? Thanx!
I want to use embedded tomcat in my application and I want to include only
bootstrap.jar in my classpath. I am wondering how to achieve this.
I wrote a class called EmbeddedTest that does what is given
org.apache.catalina.startup.Embedded. I added catalina.jar in my classpath to compile
the file.
I removed catalina.jar from my classpath after that.
I wrote another class to set up classloaders and call EmbeddedTest
I set up the classloaders thus:
commonloader = ClassLoaderFactory.createClassLoader(commonclassesdirs, commonlibdirs,
null);
catalinaloader = ClassLoaderFactory.createClassLoader(catalinaclassesdirs,
catalinalibdirs, commonloader);
Class embeddedcls = catalinaloader.loadClass("EmbeddedTest");
Method method = embeddedcls.getMethod("main", new Class[]{args.getClass()});
method.invoke(embeddedcls, new Object[]{args});
When I run this I see the error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/catalina/L
ifecycleException
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getMethod(Class.java:888)
at LaunchTomcat.main(LaunchTomcat.java:43)
The error goes away if I make my EmbeddedTest as part of package
org.apache.catalina.startup - which I dont to do.
And even if I made as part of the package org.apache.catalina.startup package it
doesnt work if I set up the EmbeddedTomcat to use any of my custom logger or realm
implementations - essentially if I refer to any class file outside of the
catalinaloader.
Am I missing something here - how do I run the embedded tomcat with out having to
include tomcats server files in my classpath?
Thanx
Ganesh
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>