• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
Justin.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
No more fooling around. Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic