Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: java.security.AccessControlException

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,659
    Thanks
    25
    Thanked 325 Times in 302 Posts

    Default java.security.AccessControlException

    Hi, I'm having a rather interesting problem.

    I have an applet that uses org.apache.commons.net.ftp.FTPClient to get a list of files in a folder on an online directory.

    When I run it on my local machine (contacting the external server), it works flawlessly. However, when I embedded the applet on the server in an html page and attempted to run the applet, I received the following exception:
    java.security.AccessControlException: access denied (java.util.PropertyPermission org.apache.commons.net.ftp.systemType read)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unkn own Source)
    at java.lang.System.getProperty(Unknown Source)
    at org.apache.commons.net.ftp.FTPClient.initiateListP arsing(FTPClient.java:3055)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTP Client.java:2731)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTP Client.java:2778)
    at airline.Connection.HttpCommunication.readCompanyNa meList(HttpCommunication.java:54)
    at airline.UserApplet.AirlineGameApplet$1.run(Airline GameApplet.java:109)
    at java.lang.Thread.run(Unknown Source)
    Anyone have any thoughts? I find it extremely suspicious that it works while in my development environment (Springsource) but not on the server. Furthermore, all of the rest of my ftp calls (which do not use apache) work perfectly.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,301
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: java.security.AccessControlException

    Is the applet signed? FTPClient relies on a Socket to connect to the remote server, which is a network connection and not allowed without Security access. The security restrictions don't typically apply in a development environment - hence the difference in behavior
    See What Applets Can and Cannot Do (The Java™ Tutorials > Deployment > Java Applets)

    The following post helped me a lot the first time I tried to sign an applet:
    https://forums.oracle.com/forums/thr...readID=1534616

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,659
    Thanks
    25
    Thanked 325 Times in 302 Posts

    Default Re: java.security.AccessControlException

    So, I started to try to do what was suggested in the link. I got to where it asks me to "Enter keystore password:", but the console won't let me type anything. I tried just pressing enter, and it then prompted me to "Re-enter new password:". Any thoughts?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,301
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: java.security.AccessControlException

    If I remember correctly, it does let you type - its a password, and thus hidden from view

  5. #5
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,659
    Thanks
    25
    Thanked 325 Times in 302 Posts

    Default Re: java.security.AccessControlException

    The cursor wasn't moving when I was typing... I was running it as Administrator, so I'm pretty sure I gave it the best possible situation.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  6. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,301
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: java.security.AccessControlException

    Quote Originally Posted by aussiemcgr View Post
    The cursor wasn't moving when I was typing... I was running it as Administrator, so I'm pretty sure I gave it the best possible situation.

    Did you type in your password when prompted, and do it again when prompted to retype? It will not display what you type, as you type, for passwords - this is a common security measure for command line utilities such as this.

  7. #7

    Default Re: java.security.AccessControlException

    Hi aussiemcgr,

    If you are still stuck with signing applet issue, this can be of help: How to sign a Java applet

  8. #8
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    939
    Thanks
    6
    Thanked 202 Times in 178 Posts

    Default Re: java.security.AccessControlException

    This thread is 6 months old!

    I notice from copeg, yesterday - "Please don't resurrect posts over a year old, especially with the intent of providing links back to (what I presume is) your webpage for self promotion". I know it's the season of goodwill and all that, but please stop doing this: it's bl00dy annoying.

  9. The Following User Says Thank You to pbrockway2 For This Useful Post:

    copeg (December 30th, 2012)

Similar Threads

  1. Java.security.AccessControlException
    By ramanareddy438 in forum Java Applets
    Replies: 3
    Last Post: December 16th, 2011, 11:47 AM
  2. Java Security Implementation for Plugin Supported Architecture
    By bgroenks96 in forum Java Theory & Questions
    Replies: 19
    Last Post: November 22nd, 2011, 03:13 PM
  3. AccessControlException caused by getCodeBase().getHost()
    By DarthCoffee in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 15th, 2011, 06:38 PM
  4. RSA Decryption with Java.security - Hex to dec to byte array conversion...
    By SeanSeanston in forum What's Wrong With My Code?
    Replies: 0
    Last Post: December 15th, 2010, 08:48 AM
  5. Security in Server
    By madhu_sushmi in forum Java Servlet
    Replies: 6
    Last Post: May 17th, 2010, 02:07 PM