• Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet not allowed to access class in it's own jar?

Justin Rowles
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet which fetches bytesstreamed information from the same server it was fetched from (in this case, localhost on port 8080).

It works perfectly with the applet viewer, so I am certain its a permissions problem, plus the Mozilla java console has this:

java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.net.www.protocol.http)

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.applet.AppletSecurity.checkPackageAccess(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

at uk.co.rms.client.store.remote.comms.Comms.communicate(Comms.java:207)

I've missed off the rest of the stack trace cos I don't think its relevant and I hate having to scroll paste huge stacks in fora!

Anyway, the line that kicks it all off is this:

conn = (HttpURLConnection) url.openConnection();

and the class that it appears not to be allowed is in package sun.net.www.protocol.http.

The daft thing is that on hitting the problem initially, I added the entire package to the archive ('applet.zip') from which the applet is run, which I would have thought made it perfectly OK.

Can anyone advise why it still doesn't work?

Thanks in advance,
Murali Kurukunda
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen a same exception stack trace in a different context. Where is the following line called from? I am sure it is inside on eof applets' internal methods, but Is it called from inside applet or is the method that has this line called from JavaScript?
conn = (HttpURLConnection) url.openConnection();

Is your applet signed?
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!