aspose file tools*
The moose likes JNLP and Web Start and the fly likes  java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark " java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)" Watch " java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)" New topic
Author

java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)

bill zhang
Greenhorn

Joined: Jul 08, 2009
Posts: 8
I have a java swing application run fine on my laptop with issuing command 'java -jar DataDictionaryGUI.jar configfile'. This jar requires ojdbc14.jar. So in its MANIFEST.MF, I put in 'Class-Path: lib/ojdbc14.jar'.
Now I wanna invoke through web start. I signed DataDictionaryGUI.jar and generated sDataDictionaryGUI.jar. The command I used was: jarsigner -keystore mystore -signedjar sDataDictionaryGUI.jar DataDictionaryGUI.jar signFiles. I did the same for ojdbc14.jar and got sojdbc14.jar. Saved it in lib directory too.
The jnlp file contains:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+"
codebase="file:///C:/Backup/SignJarTest/"
>
<information>
<title>Data Ditionary Lookup</title>
<vendor>Java Developer Connection</vendor>
<homepage href="/jdc" />
<description>Demonstration of JNLP</description>
</information>
<offline-allowed/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6" />
<jar href="file:///C:/Backup/SignJarTest/sDataDictionaryGUI.jar"

main="true"/>
<jar href="file:///C:/Backup/SignJarTest/lib/sojdbc14.jar"/>
</resources>
<application-desc

main-class="com.mincom.cis.datadictionary.main.RetrieveDataDictionary" />
</jnlp>

After I invoked the jnlp file, JFrame window showed up as we don't need jdbc at the moment. After I clicked a button which required jdbc, I got error:
java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)....

Log is below:

Reading certificates from 4526 file:/C:/Backup/SignJarTest/sDataDictionaryGUI.jar | C:\Documents and Settings\bz\Application Data\Sun\Java\Deployment\cache\6.0\26\7bad111a-33f16687.idx
Reading certificates from 51154 file:/C:/Backup/SignJarTest/lib/sojdbc14.jar | C:\Documents and Settings\bz\Application Data\Sun\Java\Deployment\cache\6.0\17\13ec8811-2d3358bb.idx

---------------------------------------------- <--- the section above showed when window appeared. The rest showed when button was clicked and jdbc was required.


Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.mincom.cis.datadictionary.model.entity.DatabaseManager.<init>(DatabaseManager.java:48)
at com.mincom.cis.datadictionary.model.entity.DatabaseManager.getInstance(DatabaseManager.java:62)
at com.mincom.cis.datadictionary.model.entity.MSFTableFactory.findByMSFTable(MSFTableFactory.java:30)
at com.mincom.cis.datadictionary.main.RetrieveDataDictionary.actionPerformed(RetrieveDataDictionary.java:65)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.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)
... 31 more


Can someone please tell me why? Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)