users@glassfish.java.net

AccessControlException using Java Web Start. Appclient script works.

From: Ryan J <subs_at_jpts.net>
Date: Fri, 26 Oct 2007 07:28:49 -0600

Hi,

I'm having some difficulty figuring out a problem I'm having. I have an
application client that runs fine when I'm using the appclient script, but gives
me an error when I try to run it using java web start.

I'm using Glassfish version b58g (2.0 final?). I see the same thing using a
Windows Vista machine and a Windows XP machine. I'm assuming it's a
configuration error I've made, but can't seem to figure it out.

Just in case it makes a difference, I split my interfaces and entities into
separate .jar files. My .ear would look something like:

- Swing Module
- EJB Module
- lib (flattened lib directory)
|- ejb-entities.jar
|- ejb-interfaces.jar

Here is the error I get using the console:

> Java Web Start 1.6.0_03
> Using JRE version 1.6.0_03 Java HotSpot(TM) Client VM
> User home directory = C:\Users\Ryan
> ----------------------------------------------------
> c: clear console window
> f: finalize objects on finalization queue
> g: garbage collect
> h: display this help message
> m: print memory usage
> o: trigger logging
> p: reload proxy configuration
> q: hide console
> r: reload policy configuration
> s: dump system and deployment properties
> t: dump thread list
> v: dump thread stack
> 0-5: set trace level to <n>
> ----------------------------------------------------
> Oct 26, 2007 2:39:00 AM com.sun.enterprise.appclient.MainWithModuleSupport prepareSecurity
> INFO: Security Manager is ON.
> Oct 26, 2007 2:39:00 AM com.sun.enterprise.appclient.MainWithModuleSupport setTargetServerProperties
> INFO: ACC001:Using ClientContainer file: [C:\Users\Ryan\AppData\Local\Temp\sunacc55012.xml].
> Oct 26, 2007 2:39:01 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
> INFO: ACC024: IIOP endpoint(s) = localhost:3700
> Oct 26, 2007 2:39:07 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
> WARNING: ACC003: Application threw an exception.
> java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Ryan\AppData\Local\Temp\acc-5ca331aa-5c68203855014\lib\jptech-sma-entities.jar 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.checkRead(Unknown Source)
> at java.io.File.isDirectory(Unknown Source)
> at java.io.File.toURI(Unknown Source)
> at com.sun.enterprise.server.PersistenceUnitInfoImpl.getPersistenceUnitRootUrl(PersistenceUnitInfoImpl.java:160)
> at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:233)
> at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
> at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
> at com.sun.enterprise.appclient.AppClientInfo.handlePersistenceUnitDependency(AppClientInfo.java:272)
> at com.sun.enterprise.appclient.AppClientInfo.completeInit(AppClientInfo.java:183)
> at com.sun.enterprise.appclient.AppClientInfoFactory.buildAppClientInfo(AppClientInfoFactory.java:149)
> at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:366)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at com.sun.enterprise.appclient.jws.boot.JWSACCMain.run(JWSACCMain.java:218)
> at com.sun.enterprise.appclient.jws.boot.JWSACCMain.main(JWSACCMain.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at com.sun.javaws.Launcher.executeApplication(Unknown Source)
> at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
> at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
> at com.sun.javaws.Launcher.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Error launching or running the application
> java.lang.reflect.InvocationTargetException
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at com.sun.enterprise.appclient.jws.boot.JWSACCMain.run(JWSACCMain.java:218)
> at com.sun.enterprise.appclient.jws.boot.JWSACCMain.main(JWSACCMain.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at com.sun.javaws.Launcher.executeApplication(Unknown Source)
> at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
> at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
> at com.sun.javaws.Launcher.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Ryan\AppData\Local\Temp\acc-5ca331aa-5c68203855014\lib\myapp-entities.jar read)
> at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:454)
> ... 15 more
> Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Ryan\AppData\Local\Temp\acc-5ca331aa-5c68203855014\lib\myapp-entities.jar 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.checkRead(Unknown Source)
> at java.io.File.isDirectory(Unknown Source)
> at java.io.File.toURI(Unknown Source)
> at com.sun.enterprise.server.PersistenceUnitInfoImpl.getPersistenceUnitRootUrl(PersistenceUnitInfoImpl.java:160)
> at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:233)
> at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
> at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
> at com.sun.enterprise.appclient.AppClientInfo.handlePersistenceUnitDependency(AppClientInfo.java:272)
> at com.sun.enterprise.appclient.AppClientInfo.completeInit(AppClientInfo.java:183)
> at com.sun.enterprise.appclient.AppClientInfoFactory.buildAppClientInfo(AppClientInfoFactory.java:149)
> at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:366)
> ... 15 more

I've seen references to creating a custom policy file while using web start, but
I've also seen it mentioned that both web start and the appclient script are
designed to run with the same permissions.

Any help would be appreciated.

Ryan