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.
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.