I am making a simple applet that uses an SQL Database.
When I use this applet locally on Netbeans it runs fine without a problem, yet when I deploy it to the Web I am getting a weird error.
I am using Java 1.6 locally, and the server I deploy on is running Java 1.6
I am using J2BC 5.1.22.
This is the error I get:
java.lang.ExceptionInInitializerError
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:315)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at FinalProject.DBConnect.<init>(DBConnect.java:29)
at FinalProject.TriviaApplet.init(TriviaApplet.java:61)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied
("java.util.PropertyPermission" "file.encoding" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.mysql.jdbc.StringUtils.<clinit>(StringUtils.java:70)
The code I use to initialize the driver is:
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(connectionURL, "db", "pw");
Does any one have any insight as to why this is occuring?
To add, my Applet gets all the information from another class. ^ The above is from DBConnect Class. An instance of this class is created, and this class does all the DB work. It was a requirement for this to be done as an applet. I have signed both my jar, and the lib jar containing the JDBC driver.