如何更改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
2023-05-13 17:05

相关问答

更多

在为每个实例打印输出时循环遍历整个文件(Loop through entire file while printing output for each instance)

你的第一个问题在于: If value = CByte(&H13) Then Return pos Exit Do End If 如果您找到第一个实例,则退出函数并丢弃BinaryReader 。 如果再次调用函数,则会在位置0创建一个新的阅读器。 尝试将代码更改为: Dim positions As New List(Of Integer)() [...] If value = CByte(&H13) Then positions.Add(pos) End If 这样你就可以...

只读行,而不是Python 2.7中的全部内容(Read only lines and not the entire thing in python 2.7)

我已经修改了您的代码以验证密码和用户名与密码检查逻辑。 这应该工作。 print "Welcome to UserName and Password Test" option = raw_input("Would you like to login or register L for Login R for register: ") if option == "R": print "Warning Only 1 user can be registered" usernamer =...

Bash - 获取包含空间的整个文件名(Bash - Get the entire file name having space in it)

for i in $folder/*; do echo "$i"; done 要么: ( cd $folder; for i in *; do echo "$i"; done ) for i in $folder/*; do echo "$i"; done or: ( cd $folder; for i in *; do echo "$i"; done )

无法在python中读取输出文件(Unable to read the output file in python)

根据您在评论中指定的要求,我已经更新了我的代码。 它在每一行中搜索“技术技能”,一旦找到,就可以写入( copy )。 一旦被击中,它将写入每一行,当找到具有“工作经验”的行时,它将停止处理。 with open("in.txt") as infile, open ("out.txt", 'w') as outfile: copy = False for line in infile: if line.strip() == "Technical Skills"...

将文件的全部内容读取到标准输出的最短方法是什么?(What is the shortest way to read the entire contents of a file to standard output? [closed])

一个(相当)短的可能性是这样的: int main(int argc, char **argv) { std::ifstream in(argv[1]); // error checking omitted for now std::cout << in.rdbuf(); } 如果文件很长,这不是最有效的,但对于你通常想要在stdout上显示的几乎任何东西,它通常都会很好。 如果您要将输出提供给其他程序,并希望更快地处理大型文件,您可以执行以下操作: #include <ios...

SAS无法读取以下空格分隔文件(SAS can't read following space delimited file)

您的文件不符合带嵌入空格的LIST输入规则。 您仍然可以在不更改文件的情况下阅读它,但您必须找到名称字段结束的列。 filename FT15F001 temp; data bad; infile FT15F001 col=col; input month @; l = findc(_infile_,' ','b') - col +1; input name $varying32. l profit :comma.; format profit comma12.; ...

读取整个文件然后在就地编辑时打印?(Read entire file then print when editing inplace?)

见perlrun 。 当-i开关被调用时,perl使用ARGVOUT作为默认文件句柄而不是STDOUT来启动程序。 如果有多个输入文件,则每当<>或<ARGV>或readline(ARGV)操作完成其中一个输入文件时,它将关闭ARGVOUT并重新打开它以写入下一个输出文件名。 一旦所有来自<>的输入被耗尽(当没有更多的文件要处理时),perl关闭ARGVOUT并将STDOUT恢复为默认文件句柄。 或者如perlrun所说 #!/usr/bin/perl -pi.orig s/foo/bar/; ...

如何从输入文件中读取对象并写入输出文件(How to read objects from an input file and write to an output file)

你的代码令人困惑。 这是我如何重构它。 我的版本将此文本写入output.txt: [Student{lastName='Zombie', firstName='Rob', id='0001', gpa=3.5, year=2013}, Student{lastName='Smith', firstName='John', id='0002', gpa=3.2, year=2012}, Student{lastName='Jane', firstName='Mary', id='0003', gp...

Java Scanner不读取整个文件(Java Scanner doesn't read entire file)

如果你正在读行: 使用Scanner ,你应该循环while (scanner.hasNextLine()) 使用BuffferedReader ,你的循环应该如此: String line; while ((line = reader.readLine()) != null) { // ... } 使用ready()作为文件结尾的测试是无效的。 见Javadoc。 Thanks for the help, but I figured it out. Like the amateur I...

拆分线后无法读取文件?(Can't read file after split line?)

你在文件的这个循环后的文件的末尾for line in file: 。 因此,下一个file.read()没有任何内容可读。 如果您真的想再次阅读该文件,可以使用以下命令开头: file.seek(0) 但是你已经阅读了歌曲中的所有歌曲,为什么重新定义songs = {}并再次删除它们? 为什么不: if choice == "1": for song, name in songs.items(): print(name, song) 使用strip()去掉\n字...

相关文章

更多

java socket server

用java编写的一个socket服务端,通过一个tcp测试工具测试这个服务端,发现发送数据给服务端,服 ...

Windows Moible, Wince 使用.NET Compact Framework的进行蓝牙(Bluetooth)开发 之 蓝牙虚拟串口 (Bluetooth Virtual Serial Port)

在之前的两篇文章分别讲述了在.NET Compact Framework下使用Windows Embe ...

OpenCms 集成外部Solr Server

OpenCms默认是以内嵌的Solr作为全文搜索服务的,不过我们也可以配置一个独立的Solr搜索服务器 ...

修改服务器的 ssh 端口后,git 拉取不到远程服务器的代码

为了安全起见,修改了服务器的ssh端口,使用idea更新git代码时,提示没法访问,解决方案:在当前用 ...

Server.xml配置文件详解

6、acceptCount 指定当所有可以使用的处理请求的线程数都被使用时

Hadoop的thrift server配置

说明:Hadoop版本:hadoop-1.2.1.tar.gz。linux系统12.04,不过这里跟系 ...

Solr 搭建搜索服务器

Solr已经发布3.5版本了,同时它是基于Lucene 3.5的。我们在基于Solr进行二次开发之前, ...

Hadoop异步rpc通信机制--org.apache.hadoop.ipc.Server

Java NOI非阻塞技术不是开启线程去等待端口的响应,而是采用Reactor模式或Observer模 ...

HTML5服务器事件发送(Server-Sent Events)【HTML5教程 - 第十三篇】

erver-Sent Events - 单向的信息处理.一个SSE(server send event ...

《Windows Server 2008服务器架设与管理教程(项目式)》扫描版[PDF]

中文名: Windows Server 2008服务器架设与管理教程(项目式) 作者: 丛书编委 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本