Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error integrating a web applet and a SmartCard application

808981Jan 11 2011 — edited Jan 13 2011
I have developed two codes separately: an applet who gets an String and makes some work with it and a console application that reads an String from a SmartCard (using javax.smartcardio package and some objects in JNA.jar).
The applet get the String from a constant String in the own class and the two codes works properly in a separate mode. The main purpose is to merge the two codes and get the applet to read the String from the Smartcard

In a first attempt to integrate the two codes, I get the following exception in the first line I try to access the SmartCard code:


java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect.generics.reflectiveObjects)
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.checkPackageAccess(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkPackageAccess(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at PinApplet.init(PinApplet.java:46)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Excepción: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect.generics.reflectiveObjects)

After exhaust all the options in my mind, can anybody give me new ideas/reasons for this exception?

Comments

safarmer
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect.generics.reflectiveObjects)
	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.checkPackageAccess(Unknown Source)
	at sun.plugin2.applet.Applet2SecurityManager.checkPackageAccess(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at PinApplet.init(PinApplet.java:46)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Excepción: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect.generics.reflectiveObjects)
You need to sign your applet to access a smart card in the browser. Since it is a restricted resource (like the file system) you need extra security permissions.
After exhaust all the options in my mind, can anybody give me new ideas/reasons for this exception?
Google returned this: 1984190

Cheers,
Shane
808981
The other thread you mentioned was started by me several months ago, but two of the users started to insult one to the other and I prefer to start a new one.
About the sign of the applet, when I use the applet separately (without accessing to the SmartCard), the applet works properly and it's not signed.
When I embedded the Smartcard access into the applet code, it's when the exception appears.
By the way, my applet is not a .jar, it's an .class. It's possible to sign a .class file instead of a .jar file??

Thanks for your contributions, Shane

Dani
808981
Reading the code, I have realized that the error was generated for the use of NotImplementedException exception from package sun.reflect.generics.reflectiveObjects
I have used UnsupportedOperationException instead of the exception below.

Anyway, I have to sign the applet, because when I am going to access the Smartcard code, the JVM launches an AccessControlException.
I redirect this problem to another thread: 2159164

Dani
safarmer
Hi,

Even though your applet is only a single class, you need to package it in a JAR file so you can sign the JAR file. I am not aware of any way to sign a class file.

Cheers,
Shane
808981
Thank you Shane. It's the same that other users have answered in the other thread and it's what I supposed :(

Dani
safarmer
805978 wrote:
Thank you Shane. It's the same that other users have answered in the other thread and it's what I supposed :(
Is this a problem? Have you tried packaging as a JAR file so it can be signed?

Cheers,
Shane
1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 10 2011
Added on Jan 11 2011
6 comments
602 views