Unable to start derby database from Netbeans 7.4

前端 未结 12 737
栀梦
栀梦 2020-12-04 12:21

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

12条回答
  •  一个人的身影
    2020-12-04 12:29

    See http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html for the description of the "problem". Search other-libs/javadb

    Depending on your requirement, what I did was go and modify the default security policy

    cd $JAVA_HOME/jre/lib/security
    

    Edit java.policy (make a backup first!)

    Add the following

    grant codeBase "file:${java.home}}/../db/lib/*" {
            permission java.security.AllPermission;
    };
    

    Note that this is my requirement.

    I'm granting every app who uses the u51 JRE the permission to start Derby.

    EDIT

    The alternative would be to use a less permissive set of permissions like:

    grant codeBase "file:${java.home}}/../db/lib/*" {
        permission java.net.SocketPermission "localhost:1527", "listen,resolve";
    };
    

    NetBeans, by default, uses the derby version installed with GlassFish. So my permissions look like this on the Mac. It will be similar on Windows, but the path will need to change.

    grant codeBase "file:/Applications/NetBeans/glassfish-4.0/javadb/lib/*" {
        permission java.net.SocketPermission "localhost:1527", "listen,resolve";
    };
    

提交回复
热议问题