java javax.servlet.ServletException:servlet 中继的 Servlet.init() 抛出异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2507574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception
提问by Talha Bin Shakir
I built application by using Netbeans and its working fine. But When i deployed on TOMCAT I am getting this error
我使用 Netbeans 构建了应用程序并且它工作正常。但是当我部署在 TOMCAT 上时,我收到了这个错误
javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
java.lang.Thread.run(Thread.java:636)
*root cause*
java.security.AccessControlException: access denied (java.util.PropertyPermission jasper.reports.compile.class.path write)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
java.security.AccessController.checkPermission(AccessController.java:553)
java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
java.lang.System.setProperty(System.java:744)
com.servlet.Relay.init(Relay.java:38)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.apache.catalina.security.SecurityUtil.run(SecurityUtil.java:269)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
Any Idea.
任何的想法。
回答by extraneon
Looks like the SecurityManager is configured to block modifications of the class path. What platform are you running on? And have a look at the tomcat conf directory for security manager configuration.
看起来 SecurityManager 被配置为阻止类路径的修改。你在什么平台上运行?并查看安全管理器配置的 tomcat conf 目录。
Check out these docsfor tomcat 5.5.
I think you should check out whether you have a file $CATALINA_BASE/conf/catalina.policy, and if so add something like:
我认为您应该检查是否有文件$CATALINA_BASE/conf/catalina.policy,如果有,请添加以下内容:
permission jasper.reports "jasper.reports.compile.class.path", "write";
If you write to that class path in your Relay servlet you should not use jasper.reports but your own package.
如果您在 Relay servlet 中写入该类路径,则不应使用 jasper.reports 而应使用您自己的包。

