使用连接到数据库的jar文件时的问题

时间:2014-12-30 18:39:19

标签: jar

我创建了一个使用derby数据库的jar文件(sms.jar),我将其包含在我的一个项目(CommunicationProject)中,我使用wildfly-8.0.0.Final来部署我的项目(CommunicationProject),以及hibernate我在sms.jar中使用derby而我在CommunicationProject中使用mysql但我有以下问题:

问题1。 我总是得到这个日志我真的不知道这只是信息还是错误

13:12:25,154 INFO  [com.mchange.v2.c3p0.SQLWarnings] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) Database 'smsDB' not created, connection made to existing database instead.: java.sql.SQLWarning: Database 'smsDB' not created, connection made to existing database instead.
at org.apache.derby.iapi.error.SQLWarningFactory.newSQLWarning(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.jar:0.9.1]
13:12:25,154 INFO  [com.mchange.v2.c3p0.SQLWarnings] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) Database 'smsDB' not created, connection made to existing database instead.: java.sql.SQLWarning: Database 'smsDB' not created, connection made to existing database instead.
at org.apache.derby.iapi.error.SQLWarningFactory.newSQLWarning(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.jar:0.9.1]
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.jar:0.9.1]

问题2. 每当我在wildfly上重新部署应用程序(CommunicationProject)时(重新启动/启动野生蝇后,在第一次部署中不会生成以下错误)我得到了以下错误

Location -> null, identityToken -> z8kfsx96zrszy08gkk4x|4b5c772, numHelperThreads -> 3 ]
13:10:46,522 WARN  [com.mchange.v2.async.ThreadPoolAsynchronousRunner] (Timer-5) com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7440f05c -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
13:10:46,527 WARN  [com.mchange.v2.async.ThreadPoolAsynchronousRunner] (Timer-5) com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7440f05c -- APPARENT DEADLOCK!!! Complete Status: 
    Managed Threads: 3
    Active Threads: 3
    Active Tasks: 
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6e703963 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9c7cb3a (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1bef51da (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
    Pending Tasks: 
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7ce6cd89
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@14c01d6f
Pool thread stack traces:
    Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
        java.lang.Thread.sleep(Native Method)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
        com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
        java.lang.Thread.sleep(Native Method)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
        com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
        java.io.FileDescriptor.sync(Native Method)
        org.apache.derby.impl.io.DirRandomAccessFile.sync(Unknown Source)
        org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source)
        org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source)
        java.security.AccessController.doPrivileged(Native Method)
        org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source)
        org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
        org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
        org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
        org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
        org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
        org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
        org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
        org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
        org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
        org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
        org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
        org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source)
        org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source)
        org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
        org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
        org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
        org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source)
        org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
        org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
        org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
        com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
        com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
        com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
        com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
        com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
        com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
        com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
        com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


13:10:59,542 WARN  [com.mchange.v2.resourcepool.BasicResourcePool] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1bef51da -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: : java.sql.SQLException: Failed to start database 'smsDB' with class loader ModuleClassLoader for Module "deployment.CommunicationProject.war:main" from Service Module Loader, see the next exception for details.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.jar:0.9.1]
Caused by: ERROR XJ040: Failed to start database 'smsDB' with class loader ModuleClassLoader for Module "deployment.CommunicationProject.war:main" from Service Module Loader, see the next exception for details.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) [derby-10.11.1.1.jar:]
    ... 17 more
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database /home/techbrainless/smsDB.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source) [derby-10.11.1.1.jar:]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_72]
    at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source) [derby-10.11.1.1.jar:]
    ... 14 more

13:10:59,552 WARN  [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (default task-9) HHH000342: Could not obtain connection to query metadata : Connections could not be acquired from the underlying database!
13:10:59,560 INFO  [org.hibernate.dialect.Dialect] (default task-9) HHH000400: Using dialect: org.hibernate.dialect.DerbyDialect
13:10:59,565 WARN  [org.hibernate.dialect.DerbyDialect] (default task-9) HHH000430: The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead
13:10:59,571 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (default task-9) HHH000422: Disabling contextual LOB creation as connection was null
13:10:59,578 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (default task-9) HHH000399: Using default transaction strategy (direct JDBC transactions)
13:10:59,581 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (default task-9) HHH000397: Using ASTQueryTranslatorFactory
13:10:59,744 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (default task-9) HHH000227: Running hbm2ddl schema export
13:10:59,931 WARN  [com.mchange.v2.resourcepool.BasicResourcePool] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9c7cb3a -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: : java.sql.SQLException: Database 'smsDB' not found.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.jar:0.9.1]
Caused by: ERROR XJ004: Database 'smsDB' not found.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) [derby-10.11.1.1.jar:]
    ... 19 more

13:10:59,932 WARN  [com.mchange.v2.resourcepool.BasicResourcePool] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6e703963 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: : java.sql.SQLException: Failed to create database 'smsDB', see the next exception for details.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.createDatabase(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) [derby-10.11.1.1.jar:]
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.jar:0.9.1]
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.jar:0.9.1]
Caused by: ERROR XJ041: Failed to create database 'smsDB', see the next exception for details.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) [derby-10.11.1.1.jar:]
    ... 17 more
Caused by: ERROR XBM0J: Directory /home/techbrainless/smsDB already exists.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.StorageFactoryService$10.run(Unknown Source) [derby-10.11.1.1.jar:]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_72]
    at org.apache.derby.impl.services.monitor.StorageFactoryService.createServiceRoot(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.impl.services.monitor.FileMonitor.createPersistentService(Unknown Source) [derby-10.11.1.1.jar:]
    at org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Unknown Source) [derby-10.11.1.1.jar:]
    ... 14 more


13:11:00,226 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (default task-9) HHH000230: Schema export complete

我检查过德比港是否打开或关闭但是我发现没有打开端口号1527,为了克服这个问题,我需要重新启动不正确的野生动物。

问题3。 我已经设置了hibernate confiugration(在jar文件中) &LT; property name="hbm2ddl.auto">create</property> 如果我把它改成

<property name="hbm2ddl.auto">update</property> 

我需要创建数据库manaully,我的要求是只在主应用程序的第一个部署时间创建数据库(sms.jar文件应该创建数据库)(使用jar文件的应用程序是CommunicationProject)并保留smsDB数据库中的数据,即使应用程序(CommunicationProject)部署为第二,第三......等时间。或者即使wildfly服务器重新启动。

<property name="hibernate.dialect"> org.hibernate.dialect.DerbyDialect
</property>
    <property name="hibernate.connection.driver_class"> org.apache.derby.jdbc.EmbeddedDriver
    </property>
    <property name="hibernate.connection.url"> jdbc:derby:smsDB;create=true
    </property>
    <property name="hibernate.connection.username"></property>
    <property name="hibernate.connection.password"></property>
    <property name="show_sql">false</property>
    <property name="connection.pool_size">3</property>
    <property name="hbm2ddl.auto">create</property>

0 个答案:

没有答案