You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Michael P. McCutcheon" <mi...@value.net> on 2000/09/17 17:24:08 UTC

EmbededTomcat and AccessControlException

I am trying to run Tomcat in my Java application.  I have started with the
EmbededTomcat.java file, and have gotten it to compile successfully.
However, when I run it, I get the following error:

ContextManager: Adding context Ctx( /main )
cannot process configuration web service using "/main /main"
Security init for Context /main failed
java.security.AccessControlException: access denied
(java.lang.RuntimePermission createCla
ssLoader)
        at
java.security.AccessControlContext.checkPermission(AccessControlContext.java
:27
2)
        at
java.security.AccessController.checkPermission(AccessController.java:399)
        at
java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
        at
java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:610)
        at java.lang.ClassLoader.<init>(ClassLoader.java:234)
        at
org.apache.tomcat.loader.AdaptiveClassLoader.<init>(AdaptiveClassLoader.java
:21
3)
        at
org.apache.tomcat.loader.AdaptiveServletLoader.<init>(AdaptiveServletLoader.
jav
a:88)
        at
org.apache.tomcat.context.LoaderInterceptor.contextInit(LoaderInterceptor.ja
va:
93)
        at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:443)
        at com.EmbededTomcat.initContext(EmbededTomcat.java:237)
        at com.EmbededTomcat.main(EmbededTomcat.java:403)
PoolTcpConnector: Starting HttpConnectionHandler on 8080

I'm starting this from a different directory than the Tomcat install
directory.  The only things I have in my directory are a webapps folder with
one web app, one WEB-INF directory, one web.xml file.  The classpath points
to all the jars at the time it is run.  Here is the main method of
EmbededTomcat:

    public static void main( String args[] ) {
 try {
     EmbededTomcat tc=new EmbededTomcat();

     tc.setWorkDir("work");

     ServletContext sctx;

     sctx=tc.addContext("/main", new URL("file://webapps/main"));
     tc.initContext( sctx );

     tc.addEndpoint( 8080, null, null);
     tc.start();
 } catch (Throwable t ) {
     t.printStackTrace();
 }
    }

Is there anything wrong with this?  Is the URL ok?

Thanks for any clues...

--
Michael P. McCutcheon
http://pwp.value.net/michaelm