当我尝试在 jsp 上运行小程序时出现 AccessControlException
当我运行 jsp 页面时,我遇到了异常,在该页面中我嵌入了小程序,
我的 jsp 文件代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<applet code="myform.applet" archive="applet.jar,ojdbc14.jar" width="600" height="480"/>
</body>
</html>
applet.jar 在其中创建了一个类,我在其中尝试从 oracle 数据库表中检索数据库值。
和例外,
Exception in thread "thread applet-myform.applet-1" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at myform.applet.init(applet.java:28)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:316)
... 5 more
我到处搜索,但没有得到我的解决方案,并且在某个地方已经以广泛的方式解释了它,作为新手我无法理解。请帮助我,这两天我一直被这个问题困扰。提前致谢。
I'm getting exception when i'm running my jsp page, in which i've embedded the applet
my jsp file code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<applet code="myform.applet" archive="applet.jar,ojdbc14.jar" width="600" height="480"/>
</body>
</html>
applet.jar in which i've made one class, in which i'm trying to retrieve the database values from the oracle database table.
and exception through
Exception in thread "thread applet-myform.applet-1" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at myform.applet.init(applet.java:28)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:316)
... 5 more
I searched everywhere, but didn't get my solution and somewhere it has been explained in a broad manner, which i can't understand as a newbie. Please help me, i'm stuck with this problem since last two days. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
小程序在安全环境中运行。 SecurityManager 控制小程序正在执行的操作,并不允许它执行禁止的操作。
从堆栈跟踪中我们可以看到 Oracle 驱动程序尝试访问 Applet 禁止的系统类加载器。
通常有 3 种方法可以解决这个问题。
Applets run in secured environment. The SecurityManager controls what applet is doing and does not allow it to perform forbidden operations.
From stack trace we can see that Oracle driver tries to access system class loader that is forbidden for applet.
You have generally 3 ways to solve this problem.