我在 Derby 上遇到数据库异常。错误堆栈如下,代码在“”行。
代码:
String[] types = { "TABLE", "ALIAS", "SYNONYM" };
DatabaseMetaData dmeta = null;
//...
//...
int n = 0;
String tblName = null;
try {
dmeta = connection.getMetaData();
rs = dmeta.getTables(null, schema, null, types);
// 这是行 DatabaseImpl.java:861
// ~~~~~~~~~ 这个方法发生错误
while (rs.next()) {
//...
//...
}
} catch (SQLException e) {
ServiceLogger.logError(e);
} finally {
try {
rs.close();
} catch (Exception e1) {
}
}
错误:
java.sql.SQLException: The exception 'java.sql.SQLException: Container 560 not found.' was thrown while evaluating an expression.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.DatabaseMetaData.getTables(Unknown Source)
at jet.server.db.core.DatabaseImpl.loadTables(DatabaseImpl.java:861)
...
// here, some lines were cut by me.
...
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.derby.client.am.SqlException: The exception 'java.sql.SQLException: Container 560 not found.' was thrown while evaluating an expression.
at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readExecuteCall(Unknown Source)
at org.apache.derby.client.net.StatementReply.readExecuteCall(Unknown Source)
at org.apache.derby.client.net.NetStatement.readExecuteCall_(Unknown Source)
at org.apache.derby.client.am.Statement.readExecuteCall(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
at org.apache.derby.client.am.DatabaseMetaData.executeCatalogQuery(Unknown Source)
at org.apache.derby.client.am.DatabaseMetaData.getTablesX(Unknown Source)
... 32 more
Caused by: org.apache.derby.client.am.SqlException: Container 560 not found.
... 42 more
错误之后,又抛出一个错误:
java.sql.SQLNonTransientConnectionException: No current connection.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.getAutoCommit(Unknown Source)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jet.server.db.core.ConnectorManager$ConnectionPool$ConnectionInvocationHandler.invoke(ConnectorManager.java:888)
at $Proxy5.getAutoCommit(Unknown Source)
at jet.server.db.adapter.DB.execute(DB.java:758)
at jet.server.db.adapter.DB.createTable(DB.java:784)
...
// ...
...
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.derby.client.am.SqlException: No current connection.
at org.apache.derby.client.am.Connection.checkForClosedConnection(Unknown Source)
... 39 more