在Fedora 15上,在Fedora上启动Lift app获取org.h2.jdbc.JdbcSQLException

时间:2011-07-02 19:44:17

标签: exception lift fedora h2

在Fedora 15上,在做了mvn jetty:run之后,当我尝试初始化用户的MetaMapper时,我得到了以下优点

org.h2.jdbc.JdbcSQLException: Exception opening port "H2 TCP Server (tcp://
192.168.1.105:33463)" (port may be in use), cause: "timeout" [90061-138]
(full stack trace is pasted last in the mail) 

以下是我如何生成项目

mvn archetype:generate \
-DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-basic_2.8.1 \
-DarchetypeVersion=2.3 \
-DarchetypeRepository=http://scala-tools.org/repo-releases \
-DremoteRepositories=http://scala-tools.org/repo-releases \
-DgroupId=com.mytest \
-DartifactId=helloworld \
-Dversion=2.0

我尝试用Sun JDK替换OpenJDK,仍然无法正常工作。 H2出了什么问题?我需要重新安装H2吗?或者是电梯问题?

如果我终止运行并重新启动另一个,我会得到相同的异常,但只是不同的tcp端口,例如

org.h2.jdbc.JdbcSQLException: Exception opening port "H2 TCP Server
(tcp://208.68.143.50:55325)" (port may be in use), cause: "timeout" [90061-138]

2 个答案:

答案 0 :(得分:0)

也许您的应用程序仍在运行或端口尚未关闭。 使用'netstat'验证。

您可能希望阅读so_reuseaddr。

我的计算机上运行了一台服务器(它的Common Lisp而不是H2,但这并不重要):

xxx@fp:~$ netstat -tulpen
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0 127.0.0.1:4005          0.0.0.0:*               LISTEN      1000       68449       7559/sbcl       

我希望一个进程正在监听208.68.143.50:55325。如果这个IP不是你的计算机,那么就会发生一些奇怪的事情。 您可以使用

启动您的应用程序
sudo strace -f mvn ... 2>&1 test.out

然后调查test.out文件。 'strace'工具允许您记录程序发出的所有系统调用。在test.out文件中搜索听。

答案 1 :(得分:0)

这很可能是网络配置问题。你能在主机文件中查看奇怪的条目吗?我的主机文件是(Mac OS):

> cat /etc/hosts
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost

如果此文件中没有任何异常,请下载H2并运行./build.sh testNetwork(或build.bat testNetwork for Windows)。在我的系统上,我得到:

Target: testNetwork
localhost:localhost/127.0.0.1
  localhost/127.0.0.1
  localhost/0:0:0:0:0:0:0:1
  localhost/fe80:0:0:0:0:0:0:1%1
getLocalHost:Thomas-Muellers-MacBook-Pro.local/192.168.0.105
  /192.168.0.105
byName:/192.168.0.105
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=55489]
server accepting
client:/192.168.0.105:55489
server accepted:Socket[addr=/192.168.0.105,port=55490,localport=55489]
client:Socket[addr=/192.168.0.105,port=55489,localport=55490]
server read:123
client read:234
server closing
server done
done
Done in 1666 ms

当然H2可以使用“localhost”,但是某些功能不能按设计工作。