tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefán F. Stefánsson <ste...@decode.is>
Subject java.security.policy problems with EmbededTomcat
Date Mon, 30 Oct 2000 11:52:26 GMT
Hi.

I'm having HUGE problems with EmbededTomcat and the Java 2 security
manager.

I'm trying to start up Tomcat through the EmbededTomcat class and adding
one context for the root.

Here is the code I'm using:
    try
    {
        EmbededTomcat tc=new EmbededTomcat();
        tc.setWorkDir( "c:/jakarta/build/tomcat/work");
        ServletContext sctx;
        sctx=tc.addContext("", new java.net.URL
            ( "file:/C:/ips"));
        tc.initContext( sctx );
        tc.addEndpoint( 8080, null, null);
        tc.start();

        while(true)
        {
            Thread.sleep(100);
        }
    }
    catch (Throwable t )
    {
        t.printStackTrace();
    }

And here is the output I'm getting from Tomcat:
ContextManager: Adding context Ctx(  ) 
cannot process configuration web service using " /C:/ips" 
Security init for Context /C:/ips failed 
java.security.AccessControlException: access denied
(java.lang.RuntimePermission createClassLoader)
	at
java.security.AccessControlContext.checkPermission(AccessControlContext.
java:272) 
	at
java.security.AccessController.checkPermission(AccessController.java:399
) 
	at
java.lang.SecurityManager.checkPermission(SecurityManager.java:545) 
	at
java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:61
0) 
	at java.lang.ClassLoader.<init>(ClassLoader.java:234) 
	at
org.apache.tomcat.loader.AdaptiveClassLoader.<init>(AdaptiveClassLoader.
java:213) 
	at
org.apache.tomcat.loader.AdaptiveServletLoader.<init>(AdaptiveServletLoa
der.java:88) 
	at
org.apache.tomcat.context.LoaderInterceptor.contextInit(LoaderIntercepto
r.java:93) 
	at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:48
0) 
	at
org.apache.tomcat.startup.EmbededTomcat.initContext(EmbededTomcat.java:2
37) 
	at TestRun.main(TestRun.java:30)
java.security.AccessControlException: access denied
(java.net.SocketPermission localhost:8080 listen,resolve) 
	at
java.security.AccessControlContext.checkPermission(AccessControlContext.
java:272) 
	at
java.security.AccessController.checkPermission(AccessController.java:399
) 
	at
java.lang.SecurityManager.checkPermission(SecurityManager.java:545) 
	at
java.lang.SecurityManager.checkListen(SecurityManager.java:1127) 
	at java.net.ServerSocket.<init>(ServerSocket.java:163) 
	at java.net.ServerSocket.<init>(ServerSocket.java:121) 
	at
org.apache.tomcat.net.DefaultServerSocketFactory.createSocket(DefaultSer
verSocketFactory.java:97) 
	at
org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.
java:239) 
	at
org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:1
88) 
	at
org.apache.tomcat.core.ContextManager.start(ContextManager.java:516) 
	at
org.apache.tomcat.startup.EmbededTomcat.start(EmbededTomcat.java:267) 
	at TestRun.main(TestRun.java:32) 

The weird thing is that I'm running the java machine with the parameters
"-Djava.security.policy==tomcat.policy" where the tomcat.policy file
resides in {JAVA_HOME}\jre\lib\security and looks like this:

grant {
    permission java.security.AllPermission;
};



This is really starting to get annoying and has taken up alot of time so
please help if you can.

Kind regards, Stefan Freyr

--------------------------------------------
Stefan Freyr Stefansson
Software Developer
deCODE Genetics, Inc.

Phone: (+354) 570 2854
GSM:   (+354) 861 1718
Fax:   (+354) 491 3782
 <<Stefan Stefansson.vcf>> 

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