如何更改HSQLDB服务器侦听的端口(How to change port that HSQLDB server listens on)
我以编程方式启动HSQLDB服务器,但是当我尝试将HSQLDB服务器与我正在开发的Web应用程序一起运行时,我遇到了端口冲突。 我在webapp端遇到以下错误
java.util.concurrent.ExecutionException: java.net.BindException: Address already in use: JVM_Bind
我在数据库服务器端遇到此错误:
org.hsqldb.HsqlException: Client driver version greater than '-1852.-79.-80.-35' is required. HSQLDB server version is '2.3.2' at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.server.ServerConnection.init(Unknown Source) at org.hsqldb.server.ServerConnection.run(Unknown Source) at java.lang.Thread.run(Thread.java:745)
我不知道为什么会出现这个错误。 但是,当我查看webapp和HSQLDB使用的端口时,我发现它们都使用9001,因此我认为问题与冲突的端口有关,而与HSQLDB版本无关。 但是,我不确定。
我知道HSQLDB使用的默认端口号是9001,我试图通过将用于9137的端口设置为以下代码来更改它。
public void startDBServer() { HsqlProperties props = new HsqlProperties(); props.setProperty("server.database.0", "file:" + dbLocation + "webappdb;"); props.setProperty("server.dbname.0", "webappdb"); props.setProperty("server.port", "9137"); dbServer = new org.hsqldb.Server(); try { dbServer.setProperties(props); } catch (Exception e) { return; } dbServer.start(); }
但是,当我尝试启动数据库服务器时,我得到以下错误堆栈跟踪:
java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused: connect2015-04-27 11:42:02,306 INFO [Thread-2] server.DatabaseWorker (DatabaseWorker.java:20) - Database server is Running at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at rideabike.server.DatabaseManager.getDBConn(DatabaseManager.java:37) at rideabike.server.DatabaseWorker.run(DatabaseWorker.java:18) Caused by: org.hsqldb.HsqlException: java.net.ConnectException: Connection refused: connect at org.hsqldb.ClientConnection.openConnection(Unknown Source) at org.hsqldb.ClientConnection.initConnection(Unknown Source) at org.hsqldb.ClientConnection.<init>(Unknown Source) ... 7 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at org.hsqldb.server.HsqlSocketFactory.createSocket(Unknown Source) ... 10 more
我还需要做些什么来尝试更改HSQLDB服务器使用的端口吗? 非常感谢任何帮助,谢谢。
I am starting a HSQLDB server programmatically, however I am getting port conflicts when I try an run the HSQLDB server in conjunction with a web application that I am developing. I get the following error on the webapp side
java.util.concurrent.ExecutionException: java.net.BindException: Address already in use: JVM_Bind
& I get this error on the database server side:
org.hsqldb.HsqlException: Client driver version greater than '-1852.-79.-80.-35' is required. HSQLDB server version is '2.3.2' at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.server.ServerConnection.init(Unknown Source) at org.hsqldb.server.ServerConnection.run(Unknown Source) at java.lang.Thread.run(Thread.java:745)
I'm not sure why I get this error. However, when I looked at the ports used by the webapp and HSQLDB, I found that they both use 9001 so I assume the issue is to do with conflicting ports and not about HSQLDB versions. However, I'm not certain about that.
I understand that the default port number used by HSQLDB is 9001 and I've tried to change this with the following code by setting the port to be used to 9137.
public void startDBServer() { HsqlProperties props = new HsqlProperties(); props.setProperty("server.database.0", "file:" + dbLocation + "webappdb;"); props.setProperty("server.dbname.0", "webappdb"); props.setProperty("server.port", "9137"); dbServer = new org.hsqldb.Server(); try { dbServer.setProperties(props); } catch (Exception e) { return; } dbServer.start(); }
However, when I then try and start the database server I get the following error stacktrace:
java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused: connect2015-04-27 11:42:02,306 INFO [Thread-2] server.DatabaseWorker (DatabaseWorker.java:20) - Database server is Running at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at rideabike.server.DatabaseManager.getDBConn(DatabaseManager.java:37) at rideabike.server.DatabaseWorker.run(DatabaseWorker.java:18) Caused by: org.hsqldb.HsqlException: java.net.ConnectException: Connection refused: connect at org.hsqldb.ClientConnection.openConnection(Unknown Source) at org.hsqldb.ClientConnection.initConnection(Unknown Source) at org.hsqldb.ClientConnection.<init>(Unknown Source) ... 7 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at org.hsqldb.server.HsqlSocketFactory.createSocket(Unknown Source) ... 10 more
Is there anything further I need to do to try and change the port that the HSQLDB server uses? Any help is greatly appreciated, thanks.
原文:https://stackoverflow.com/questions/29894028
相关问答
更多在为每个实例打印输出时循环遍历整个文件(Loop through entire file while printing output for each instance)
只读行,而不是Python 2.7中的全部内容(Read only lines and not the entire thing in python 2.7)
Bash - 获取包含空间的整个文件名(Bash - Get the entire file name having space in it)
无法在python中读取输出文件(Unable to read the output file in python)
将文件的全部内容读取到标准输出的最短方法是什么?(What is the shortest way to read the entire contents of a file to standard output? [closed])
SAS无法读取以下空格分隔文件(SAS can't read following space delimited file)
读取整个文件然后在就地编辑时打印?(Read entire file then print when editing inplace?)
如何从输入文件中读取对象并写入输出文件(How to read objects from an input file and write to an output file)
Java Scanner不读取整个文件(Java Scanner doesn't read entire file)
拆分线后无法读取文件?(Can't read file after split line?)
相关文章
更多java socket server
Windows Moible, Wince 使用.NET Compact Framework的进行蓝牙(Bluetooth)开发 之 蓝牙虚拟串口 (Bluetooth Virtual Serial Port)
OpenCms 集成外部Solr Server
修改服务器的 ssh 端口后,git 拉取不到远程服务器的代码
Server.xml配置文件详解
Hadoop的thrift server配置
Solr 搭建搜索服务器
Hadoop异步rpc通信机制--org.apache.hadoop.ipc.Server
HTML5服务器事件发送(Server-Sent Events)【HTML5教程 - 第十三篇】
《Windows Server 2008服务器架设与管理教程(项目式)》扫描版[PDF]
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!