简体   繁体   English

netbeans - java db server无法启动

[英]netbeans - java db server doesn't start

I'm trying to use Java DB in netbeans but the server doesn't start. 我正在尝试在netbeans中使用Java DB,但服务器无法启动。 I've tried adding 我试过添加

grant {
          permission java.net.SocketPermission "localhost:1527", "listen";
}

but it didn't make any difference. 但它没有任何区别。 I don't know what causes a problem. 我不知道是什么原因导致了问题。 I successfully started the server using cmd but I still cannot connect to the database (the window "connecting to database" pops out but nothing happens, I also don't get any output from Java DB Database Proccess) Any help will be very appreciated. 我使用cmd成功启动了服务器,但我仍然无法连接到数据库(“连接到数据库”窗口弹出但没有任何反应,我也没有从Java DB数据库进程获得任何输出)任何帮助将非常感激。

I have the same problem. 我也有同样的问题。 I found a workaround. 我找到了一个解决方法。 Just change db provided with Java to the one provided with GlassFish: 只需将Java提供的数据库更改为GlassFish提供的数据库:

  1. Make sure you have NetBeans installation with GlassFish (and JavaDB) 确保使用GlassFish(和JavaDB)安装NetBeans
  2. Open dialog NetBeans → ProjectManager → Services → Databases → JavaDB(right click) → Properties: 打开对话框NetBeans→ProjectManager→服务→数据库→JavaDB(右键单击)→属性:

    原始路径

  3. My screen is from Linux installation. 我的屏幕来自Linux安装。 You probably have something like C:\\java\\jdk1.8.0_40\\db as Java DB Installation. 您可能有类似C:\\ java \\ jdk1.8.0_40 \\ db的内容作为Java DB安装。 . Change this path to the one from Glassfish. 将此路径更改为Glassfish中的路径。 I don't know where it is on Windows, here's mine path: 我不知道它在Windows上的位置,这是我的路径:

    修正路径

This is only workaround, as I don't know why JavaDB server provided by Oracle with Java >= 1.8.0_40 exits immediate after execution. 这只是解决方法,因为我不知道为什么Oracle提供的Java> = 1.8.0_40的JavaDB服务器在执行后会立即退出。 Probably this is some kind of bug. 可能这是某种错误。

This may be duplicated issue ( Netbeans not starting Java DB Server with JDK 1.8.0_40 ), but I am not sure. 这可能是重复的问题( Netbeans没有使用JDK 1.8.0_40启动Java DB Server ),但我不确定。

Try the grant code as: 尝试授予代码:

grant{ 
   permission java.net.SocketPermission "localhost:1527", "listen,resolve"; 
};

Also, read Here (click) about the related bug(fix) in the JDK tool 另外,请阅读这里(单击)关于JDK工具中的相关错误(修复)

I had the same problem recently with netbeans 8.2 and JDK 8. I'm writing the solution here for future references. netbeans 8.2和JDK 8最近遇到了同样的问题。我在这里编写解决方案以供将来参考。

  • Go to https://db.apache.org/derby/releases/release-10.14.2.0.cgi and download the latest version of derby driver (today is 10.14.2.0). 转到https://db.apache.org/derby/releases/release-10.14.2.0.cgi并下载最新版本的derby驱动程序(今天是10.14.2.0)。
  • Extract it and place the extracted folder in your %JAVA_HOME%. 解压缩并将解压缩的文件夹放在%JAVA_HOME%中。 The result will be something like this: C:\\Program Files\\Java\\jdk1.8.0_92\\db-derby-10.14.2.0-bin. 结果将是这样的:C:\\ Program Files \\ Java \\ jdk1.8.0_92 \\ db-derby-10.14.2.0-bin。
  • Inside netbeans, in the services tab, right click on Java DB > Properties and configure the location of your new derby driver as below. 在netbeans内部,在服务选项卡中,右键单击Java DB> Properties并配置新derby驱动程序的位置,如下所示。

在此输入图像描述

  • Start again the Java DB server to see it working. 再次启动Java DB服务器以查看它是否正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM