Reputation: 61
I am having a problem using netbeans in which im trying to start the Java DB. Its giving me an access denied error. After some research i have found this Unable to start derby database from Netbeans 7.4 which provides a fix. I attempted to edit the java policy file but I am unable to open the java.policy file because I am unsure how. I have also found this, which says how to open the poicy file http://docs.oracle.com/javase/tutorial/security/tour2/wstep1.html but when I enter policy tool at command line, nothing pops up.
This is the error i keep recieving
Mon Jan 27 13:09:48 EST 2014 : Security manager installed using the Basic server security policy.
Mon Jan 27 13:09:48 EST 2014 : access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")
java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkListen(SecurityManager.java:1134)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
at org.apache.derby.impl.drda.NetworkServerControlImpl.createServerSocket(Unknown Source)
at org.apache.derby.impl.drda.NetworkServerControlImpl.access$000(Unknown Source)
at org.apache.derby.impl.drda.NetworkServerControlImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source)
at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source)
at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)
Upvotes: 3
Views: 10122
Reputation: 71
I'm on a Mac (running OSX Mavericks, JDK 1.7 update 51, and Glassfish 4.0) and I had the same problem being unable to edit the file. So I did the following:
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/
sudo vim java.policy
a
// permission for Glassfish 4.0 deployment permission java.net.SocketPermission "localhost:1527", "listen";
:wq
Upvotes: 1
Reputation: 556
Make sure you back up the policy file before attempting to edit :)
The policy file is just a text file. You would edit like you would a java source file (I.E. with a text editor). Remember, make a backup of the file first (play it safe).
Hope that helps:)
Upvotes: 0