English 中文(简体)
从SerletContext获得ClassLoader()后,可进入ControlException
原标题:getClassLoader() from ServletContext leads to AccessControlException
  • 时间:2011-10-25 16:13:54
  •  标签:
  • java

I m trying to do the following (running in Jetty 8):

public class FooListener implements ServletContextListener {
  public void contextInitialized(ServletContextEvent event) {
    event.getServletContext().getClassLoader();
  }
}

这是我忘记的:

java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at java.security.AccessController.checkPermission(AccessController.java:546)
at org.eclipse.jetty.server.handler.ContextHandler$Context.getClassLoader(ContextHandler.java:2179)
at com.example.FooListener.contextInitialized(FooListener.java:69)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:672)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:403)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:664)

What is it about and how can be solved?

最佳回答

喷气机由一位安全主管操作,该主管限制服务器能够做的工作(避免使用旧式编码,以便能够向服务器集装箱做新东西)。 绕过这一问题,就是要从安全主管那里转手,在你的喷气机开稿中寻找这个三百条选择:

-Djava.security.manager

但必须认识到:这一转变取消了所有的安全检查,更好的办法是加强政策档案,寻找这一选择:

-Djava.security.policy=

这些文件是:

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签