Hi Craig
Thanks for your reply and apologies for the late reply. The goalposts
have changed slightly but the problem appears to be the same.
I've set up the MBean server environment to create the two classloaders
(a la Bootstrap) and when I fire up the server with a Security Manager,
I find that the (catalina) loader can find the javax.servlet.Servlet
class but the Container Base cannot.
servlet.jar is not in any CLASSPATH (save the classloaders).
For the simple example ......
System.out.println(CatalinaClassLoaders.getCatalinaClassLoader());
System.out.println(CatalinaClassLoaders.getSharedClassLoader());
try {
System.out.println(Thread.currentThread().getContextClassLoader().loadClass("javax.servlet.Servlet"));
} catch (Exception ex) {
ex.printStackTrace();
}
Embedded embedded = new Embedded();
Engine engine = embedded.createEngine();
......... I get the following output showing the classloaders (including
the servlet.jar), the 'javax.servlet.Servlet' interface and then the
stacktrace with NoClassDefFoundError: javax/servlet/Servlet Exception
...
StandardClassLoader
available:
delegate: false
repositories:
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/server/lib/jakarta-regex
p-1.2.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/server/lib/crimson.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/server/lib/catalina.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/server/lib/warp.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/server/lib/jaxp.jar
required:
----------> Parent Classloader:
StandardClassLoader
available:
delegate: false
repositories:
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/servlet.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/naming.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/resources.jar
required:
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader@2c3c08
StandardClassLoader
available:
delegate: false
repositories:
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/lib/namingfactory.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/lib/jasper-runtime.jar
required:
----------> Parent Classloader:
StandardClassLoader
available:
delegate: false
repositories:
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/servlet.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/naming.jar
file:/export/home/servers/web/jakarta-tomcat-4.0-b7/common/lib/resources.jar
required:
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader@2c3c08
interface javax.servlet.Servlet
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/servlet/Servlet
Exception
at
org.apache.catalina.core.ContainerBase.<init>(ContainerBase.java:254)
at
org.apache.catalina.core.StandardEngine.<init>(StandardEngine.java:10
4)
at
org.apache.catalina.startup.Embedded.createEngine(Embedded.java:577)
at
com.syntactics.server.management.catalina.Bootstrap.<init>(Bootstrap.
java:191)
at
com.syntactics.server.management.catalina.Bootstrap$1.run(Bootstrap.j
ava:61)
at java.security.AccessController.doPrivileged(Native Method)
at
com.syntactics.server.management.catalina.Bootstrap.main(Bootstrap.ja
va:58)
.... this code is running in class driven by a PrivilegedAction.
Getting this to work with MBeans and a Security Manager is turning out
to be quite tricky!
Cheers
Nick
>On Wed, 22 Aug 2001, Nick Betteridge wrote:
>
>
>> javax.servlet.ServletException: Class
>> org.apache.jasper.servlet.JspServlet is not a Servlet
>
>The only time I've seen this kind of thing happen is when servlet.jar is
>loaded from the "wrong" class loader -- it needs to be visible to both
>Catalina internal classes *and* web apps. In the usual stand-alone
>configuration, this is accomplished by putting servlet.jar into the
>$CATALINA_HOME/common/lib directory. Also, make sure servlet.jar is *not*
>in your Java system extensions directory ($JAVA_HOME/jre/lib/ext) or on
>the CLASSPATH.
>
>Could you double check to see if any of those issues might be the problem?
>
>> Nick
>
>Craig