jQuery in Action, 3rd edition
The moose likes Security and the fly likes AccessControlException using custom ClassLoader with WebStart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "AccessControlException using custom ClassLoader with WebStart" Watch "AccessControlException using custom ClassLoader with WebStart" New topic

AccessControlException using custom ClassLoader with WebStart

Michael Remijan
Ranch Hand

Joined: May 29, 2002
Posts: 128

I have created a very basic database brower application. To provide the most fexibility, I allow users to enter the connection string and choose the *.jar file that contains the JDBC drivers for their database. Each JDBC driver is loaded using a custom ClassLoader that I created. The allows the user to connect to an Oracle, PostgreSql, MySQL, databases all at the same time and, by specifying the *.jar files themselves, I do not have to distribute dozens of jars with my application.
When I start the application via WebStart, the the signed jar files successfully all <AllPermission>. However, when my custom ClassLoader tries to read the jar file that a user specifies, I get an AccessControlException. Specifically, the exception is being thrown when my code hits the File.isDirectory() method (The custom ClassLoader I created can be given a directory and it will pickup every *.jar file in that directory).
Does anyone have any idea why my custom ClassLoader would not be able to access the jar file a user specifies? Do I have to register my custom ClassLoader with the SecurityManager in some way?

Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Moving to the Security forum.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link: http://aspose.com/file-tools
subject: AccessControlException using custom ClassLoader with WebStart
It's not a secret anymore!