1

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!

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

The security sand-box used for applets and JWS apps. is the same, with only slight differences in the policies used. Examples of differences are 1) even a signed applet cannot call System.exit(n) 2) JWS apps. have not only all-permissions and sand-boxed, but also another level in between. Otherwise, +1. Avoid policy files, they are only good for arcane situations (like development, though I sign Jars in the build, if need be).
@AndrewThompson - JNLP indeed doesn't give enough permissions for the OP to be able to connect to a database without signing. I'll update my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.