user1252909
user1252909

Reputation: 11

Java Applet issue with mySQL

I have made a .jar file called test.jar and am trying to put it onto a webpage called login.html (all locally). Within the applet tag I have put mysqlconnector.jar and test.jar in the archive section.

When I try to run the applet using: appletviewer "file:///c:/test/login.html" the applet loads but when I try to login and click ok I get the following error

    Exception in thread "AWT-EventQueue-1" java.lang.ExceptionInInitializerError
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :286)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at staffDatabase.queryStaffID(staffDatabase.java:76)
    at searchStaff.readFromLogin(searchStaff.java:14)
    at loginFrame$1.actionPerformed(loginFrame.java:65)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
    95)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6263)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574
)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.security.AccessControlException: access denied (java.util.Proper
tyPermission file.encoding read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:323)
    at java.security.AccessController.checkPermission(AccessController.java:
546)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
85)
    at java.lang.System.getProperty(System.java:650)
    at com.mysql.jdbc.StringUtils.<clinit>(StringUtils.java:70)
    ... 30 more

I've looked at several other websites that suggest the

    Caused by: java.security.AccessControlException: access denied (java.util.Proper
tyPermission file.encoding read)

is due to lacking read permissions from policytool, but I have already put all permissions on and this has made no difference.

Any help would be appreciated! I have looked everywhere with no luck so far, thanks!

Upvotes: 1

Views: 249

Answers (1)

Perception
Perception

Reputation: 80603

Changing your policy file is not going to cut it, you still need to sign the applet. Note that ss an alternative you may choose to deploy your app via JNLP. This will get you a higher default set of permissions, but for what you are doing (requesting socket permissions) the application will still need to be signed.

Upvotes: 2

Related Questions