access denied while loading jar files from client

I am creating a platform

that can be started by JWS

and then load plug-ins from client drive.

I've signed my platform (packaged as a jar file),

and set up the security tag in my jnlp,

so that it can access client files.

The plug-ins are packaged as jar files.

And in one of the plug-ins, there is a class that has a JFileChooser field.

While initializing this field, the AccessControlException is thrown.

I can't figure out what is wrong,

So I tried to sign the plug-in, but the problem stands still.

PS. I have made my own ClassLoader,

and this platform works well without JWS.

Please help me, thanks.

Below is the error message:

Java Web Start 1.4.2 主控台,已啟動 Fri Jul 02 01:31:17 CST 2004

Java 2 Runtime Environment:版本 1.4.2,作者:Sun Microsystems Inc.

/*my own log message*/

2004/7/2 上午 01:31:23 pluginmanager.Activater activate /*this is my own classloader*/

配置: activate jar=\Plugins\Common.jar /*load plug-in Common.jar*/

2004/7/2 上午 01:31:23 pluginmanager.Activater activate

細緻: collect resources /*collect other jar files needed by Common.jar*/

2004/7/2 上午 01:31:23 pluginmanager.Activater activate

細緻: load plugin=\Plugins\Common.jar

2004/7/2 上午 01:31:23 pluginmanager.Activater activate

細緻: activating class name=filemanager.FileManager /*instantiate plug-in component*/

java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir 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 java.io.Win32FileSystem.getUserPath(Unknown Source)

... /*cut*/

at javax.swing.JFileChooser.<init>(Unknown Source)

at filemanager.Open.<init>(Open.java:20)

at filemanager.FileManager.<init>(FileManager.java:38)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

... /*cut*/

at java.lang.Class.newInstance(Unknown Source)

at pluginmanager.Activater.activate(Activater.java:120)

at pluginmanager.PluginManager$ActivateAction.actionPerformed(PluginManager.java:53)

[2638 byte] By [bsdsonlee] at [2007-9-30 12:08:01]
# 1

When running under Java Web Start, a security manager is installed.

Since you have created your own classloader, you are responsible for assigning permissions to the classes you load.

You can change you class loader to extend SecureClassLoader, then override getPermissions:

protected PermissionCollection getPermissions(CodeSource codesource) {

PermissionCollection perms = super.getPermissions(codesource);

/* add whatever permissions you want your code to hance*/

perms.add( ... );

/* or just add all-permissions */

perms.add(new AllPermission());

}

or - you can just remove the Security Manager:

System.setSecurityManager(null);

/Dietz

dietz333 at 2007-7-4 14:50:28 > top of Java-index,Desktop,Deploying...