我正在尝试按照指示设置 Virgo 示例项目绿页(http://www.eclipse.org/virgo/documentation/greenpages-documentation-2.4.0.RELEASE/docs/html/ch02s03.html)。当我执行数据脚本时,我得到一个异常。
数据库是这样启动的:
start java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar"
org.h2.tools.Server
插入在此行失败的数据的脚本:
java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar"
org.h2.tools.RunScript
-url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages
-user greenpages -password pass -script db.sql
例外是:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-161]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:435)
at org.h2.store.FileLock.lockFile(FileLock.java:332)
at org.h2.store.FileLock.lock(FileLock.java:128)
at org.h2.engine.Database.open(Database.java:539)
at org.h2.engine.Database.openDatabase(Database.java:219)
at org.h2.engine.Database.<init>(Database.java:214)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:124)
at java.lang.Thread.run(Unknown Source)
at org.h2.engine.SessionRemote.done(SessionRemote.java:538)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:109)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:373)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:267)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.h2.tools.RunScript.process(RunScript.java:312)
at org.h2.tools.RunScript.runTool(RunScript.java:140)
at org.h2.tools.RunScript.main(RunScript.java:68)