• 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

Socket Permissions Problem using Java applet on Windows but not on Mac

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem with java.security.AccessControlException.access denied when using any Windows OS / Browser with my java applet.

I get a (java.net.socket permission [IP address]:PORT connect, resolve) error.

However, when I use a Mac OS / Browser the applet works correctly?

The service is running on a Tomcat server and I have looked into security policies but I am new to java applets / sockets etc so I am looking for some guidance.

The applet function basically allows files to be uploaded/downloaded using a MySQL database.

Can anyone help please?

Thanks



 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Please read this for applet security issues.

I'll move this thread to our Applets forum.
 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 things you need to do.
1. Get the system security manager to do accept your permission checks. Here are 2 examples :

Replace xxx.xxx.xxx.xxx with the server IP address.

The RunTime is for a thread (obviously).
Put the needed lines as your first code in the main method.


2. You have to sign the JAR file
i.
Fill out all this information. It will create a keystore named "keystore" (you can change it to whatever name you would like)
ii. Put a certificate on it. You could pay to have it certificated or sign it yourself :

iii.

NOTE: Remember the passwords you put in these.

Enjoy!
John Price
 
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you signed the applet and all external libraries (jars), you do not need to write permission checking code.
Remember to sign external jars as well, not only the Applet jar itself. I had permission exception problem and had not figured out until I found some external jars were not signed. I signed all of them then everything was fine.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may also habe to run the code as privileged code, which is described in the link Rob posted.
 
Philip Underhill
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the suggestions.

I will try the jar signing and see what results I get. I am new to this so I don't want to rush into things.

Does it make any sense that the applet works in a Mac environment and not Windows?
reply
    Bookmark Topic Watch Topic
  • New Topic