tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Rapp <alr...@yahoo.com>
Subject Running Embedded Tomcat from Java Web Start
Date Thu, 24 May 2007 16:39:08 GMT
Hi All,

I'm trying to launch Embedded Tomcat from Java Web Start (JNLP), but without any luck so far.
 I've searched high and low and found several folks who have tried this approach but no one
has seemed to succeed.  Just to clarify, I'm not trying to run Java Web Start from Embedded
Tomcat, but actually the reverse: start Embedded Tomcat on the client's machine, via Java
Web Start.  

Tomcat starts but I get the following exception:

            ----------> Parent Classloader:
                sun.misc.Launcher$AppClassLoader@11b86e7
                 org.apache.jasper.servlet.JspServlet
                java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
    at org.apache.catalina.core.StandardWrapper$1.run(StandardWrapper.java:1051)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1047)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:822)

Apparently a classloader issue with JNLP, but I don't know how to set the classloader on Tomcat.
 

I also tried launching Embedded Tomcat via a URLClassLoader.  With the URLClassLoader I get:
java.security.AccessControlException: access denied (java.util.PropertyPermission catalina.home
write).  It seems that the URLClassLoader is not running with the same privileges as the JNLP
classloader.

I'm using the following code to start tomcat.

        System.setProperty("catalina.home", getPath());
            
        embedded = new Embedded();

        Engine engine = embedded.createEngine();
        engine.setDefaultHost("localhost");

        host = embedded.createHost("localhost", getPath() + "/webapps");
        engine.addChild(host);

        Context context = embedded.createContext("", getPath() + "/webapps/ROOT");

        host.addChild(context);

        embedded.addEngine(engine);

        Connector connector = embedded.createConnector((java.net.InetAddress) null, 11080,
false);
        embedded.addConnector(connector);
        embedded.start();

Any suggestions will be appreciated.

Andrew


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message