Results 1 to 6 of 6
  1. #1
    oki
    oki is offline Member
    Join Date
    Aug 2011
    Posts
    20
    Rep Power
    0

    Default Adding an MYSQL java driver to an APPLET project

    How can I add external jars to an applet project so they can be used witihin the applet on a webpage. (MYSQL java driver in an applet)

  2. #2
    oki
    oki is offline Member
    Join Date
    Aug 2011
    Posts
    20
    Rep Power
    0

    Default

    Guys I get this

    Java Code:
    java.lang.reflect.InvocationTargetException
    	at java.awt.EventQueue.invokeAndWait(Unknown Source)
    	at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
    	at applet.appletMain.init(appletMain.java:53)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ExceptionInInitializerError
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:286)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at applet.standardDB.main(standardDB.java:18)
    	at applet.appletMain$1.run(appletMain.java:56)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.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)
    	... 19 more
    HELP ME OUT

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    access denied (java.util.PropertyPermission file.encoding read
    Your applet needs permission to read properties. You can give it permission by signing the jar file or by making changes to the local JRE's .java.policy file.
    Last edited by Norm; 08-27-2011 at 12:15 AM.

  4. #4
    oki
    oki is offline Member
    Join Date
    Aug 2011
    Posts
    20
    Rep Power
    0

    Default

    Signed the jar ( i get a prompt do i want to trust this program cuz it signiture could not be verified) and still get this

    Java Code:
    Exception in thread "Thread-11" java.lang.ExceptionInInitializerError
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:286)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at applet.standardDB.run(standardDB.java:25)
    	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)
    	... 5 more
    Files on server are read/execute chmod 755 (+write for admin)

  5. #5
    oki
    oki is offline Member
    Join Date
    Aug 2011
    Posts
    20
    Rep Power
    0

    Default

    I keep the classes on the server in folders - when i try to connect by clicking on a button there is a prompt ( something about that soe components are not signed) if i click yes i get some loading problem (Class.forName Exception) and if i click no then it is loaded but i get an exception about the acces reading. How to add that jar in a good way ? IM tearing my hair out .... I tried adding a lib katalog and copying the jar into it and addigng is as a refference to an internal jar ... But still nothing :/.
    Last edited by oki; 08-27-2011 at 09:09 AM.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    access denied ("java.util.PropertyPermission" "file.encoding" "read")
    For testing you could change the local .java.policy file to give all codebases permission to read properties.
    Use the policytool program and make any entry something like this:

    permission java.util.PropertyPermission "*", "read";

Similar Threads

  1. com.mysql.jdbc.Driver
    By uthpalaw in forum Eclipse
    Replies: 2
    Last Post: 10-14-2010, 05:09 AM
  2. How to configure Java mysql driver and CLASSPATH?
    By fish309 in forum New To Java
    Replies: 14
    Last Post: 07-20-2010, 09:51 AM
  3. Problems with MySQL Driver
    By islan in forum JDBC
    Replies: 7
    Last Post: 08-06-2009, 04:47 PM
  4. can't register a MySQL driver
    By prfalco in forum New To Java
    Replies: 4
    Last Post: 02-03-2008, 11:13 PM
  5. mysql driver problem
    By mokingsu in forum JDBC
    Replies: 4
    Last Post: 01-17-2008, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •