I downloaded Netbeans 7.4 and Java 7 Update 51. I get the below error when I try to start Java DB or derby connection from Netbeans. This is on a windows 8 PC. I downloaded the version for windows xp 32 bit at work. It works fine. I am not sure what is missing.
Thu Jan 16 00:48:23 EST 2014 : Security manager installed using the Basic server security policy. Thu Jan 16 00:48:24 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)
Once NetBeans is running, select the Services tab, expand the Databases entry, right-click on JavaDB, select Properties. For the Derby location, enter the directory where you installed the Derby library. For the databases location, you can choose any directory you want.
Download the latest Derby version from the Apache website http://db.apache.org/derby/. Choose the bin distribution and extract this zip to a directory of your choice. Also make the Derby tools available in your path: Set the environment variable DERBY_HOME to the Derby installation directory.
In this chapter, we will work with the Derby database inside the NetBeans IDE. NetBeans has a built-in support for the Derby database in its basic Java SE bundle.
NetBeans has a built-in support for the Derby database in its basic Java SE bundle. So far we have worked with the Apache Derby distribution. In this chapter, we will work with Java DB. It is the same database, only under a different name. Java DB is shipped with Java distribution from Java 6 version.
The Java DB Database menu options are displayed when you right-click the Java DB node in the Services window. This contextual menu items allow you to start and stop the database server, create a new database instance, as well as register database servers in the IDE (as demonstrated in the previous step).
So far we have worked with the Apache Derby distribution. In this chapter, we will work with Java DB. It is the same database, only under a different name. Java DB is shipped with Java distribution from Java 6 version.
This is what I did:
Find out exactly where the java home is by executing this instruction from NetBeans 7.4 :
System.out.println(System.getProperty("java.home"));
This is the output for my case:
C:\Program Files\Java\jdk1.7.0_51\jre
which is quite important for me, I was modifying another java.policy
and took no effect and wasted me a couple of hours.
For reason of java.policy
is an unix style file and read-only, I opened and edited it with notepad++ and executed as administrator (under the same java home):
C:\Program Files\Java\jdk1.7.0_51\jre\lib\security\java.policy
Add only these lines into the file after the first grant:
grant { permission java.net.SocketPermission "localhost:1527", "listen"; };
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With