java.io.IOException 建立資料庫 'derbydb' 失敗,詳細資訊請參閱下一個例外

 常見問題 > 錯誤 > 例外 > java.io.IOException 建立資料庫 'derbydb' 失敗,詳細資訊請參閱下一個例外

如果您收到類似這樣的錯誤

Jun 19, 2006 10:35:27 PM org.apache.activemq.broker.BrokerService getBroker
INFO: ActiveMQ Classic 4.0 JMS Message Broker (localhost) is starting
Jun 19, 2006 10:35:27 PM org.apache.activemq.broker.BrokerService getBroker
INFO: For help or more information please see: http://incubator.apache.org/activemq/
java.io.IOException: Failed to create database 'derbydb', see the next exception for details.
       at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:42)
       at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:58)
       at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:229)
       at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:213)
       at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:139)
       at org.apache.activemq.store.journal.JournalPersistenceAdapter.start(JournalPersistenceAdapter.java:215)
       at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:930)
       at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:888)
       at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:458)
       at org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:143)
       at org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:133)
       at com.ic.ntn.message.HelloWorld$HelloWorldBroker.run(HelloWorld.java:92)
       at java.lang.Thread.run(Thread.java:595)
Caused by: SQL Exception: Failed to create database 'derbydb', see the next exception for details.
       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedConnection.createDatabase(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
       at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
       at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
       at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
       at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
       at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:54)
       ... 11 more

那麼錯誤很可能是 JDBC 驅動程式(預設為 Apache Derby)無法寫入持久檔案區域。

解決方法

建立一個目錄,供代理程式寫入其檔案。例如,在 Java 程式碼中呼叫 setDataDirectory

File dir = new File("foo");
dir.mkdir();
broker.setDataDirectory(dir);

或者在 XML 中使用

<broker dataDirectory="foo">...

參見

Apache、ActiveMQ、Apache ActiveMQ、Apache 羽毛標誌和 Apache ActiveMQ 專案標誌是 Apache 軟體基金會的商標。版權所有 © 2024,Apache 軟體基金會。依 Apache License 2.0 授權。