2013-01-16 45 views
0

在我們的項目中我們使用Spring & Hibernate。在服務器和其他Developers機器項目上運行成功。然而,在我通過SVN更新我的項目之後,我得到一個錯誤列表,並且我無法解決它兩天。我已經閱讀了很多關於它的文章,並試着解決問題。甚至,我已經完全刪除了項目並再次結帳,恢復了數據庫但沒有任何更改。 MySQL是檢查和工作,Spring&Hibernate c3p0錯誤無法完成模式驗證

這是錯誤的:

Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 
2013-01-16 04:36:22,512 ERROR [org.hibernate.tool.hbm2ddl.SchemaValidator] - could not complete schema validation 
java.sql.SQLException: Connections could not be acquired from the underlying database! 
... 
2013-01-16 04:36:22,526 WARN [net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory] - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.StandardQueryCache]; using defaults. 
2013-01-16 04:36:33,475 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com[email protected]10dba0d -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! 
2013-01-16 04:36:33,476 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com[email protected]10dba0d -- APPARENT DEADLOCK!!! Complete Status: 
    Managed Threads: 1 
Active Threads: 1 
Active Tasks: 
    [email protected]2b (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) 
Pending Tasks: 
    [email protected]43 
Pool thread stack traces: 
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) 
2013-01-16 04:36:51,878 WARN [com.mchange.v2.resourcepool.BasicResourcePool] - [email protected]2b -- 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: No suitable driver 
at java.sql.DriverManager.getDriver(DriverManager.java:264) 
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223) 
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) 
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) 
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) 
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) 
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) 
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) 
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 

這裏是Hiernate> C3P0的conf

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> 
    <property name="jdbcUrl" value="${jdbc.url}" /> 
    <property name="user" value="${jdbc.username}" /> 
    <property name="password" value="${jdbc.password}" /> 
    <property name="initialPoolSize" value="1" /> 
    <property name="minPoolSize" value="1" /> 
    <property name="maxPoolSize" value="5" /> 
    <property name="idleConnectionTestPeriod" value="500" /> 
    <property name="acquireIncrement" value="1" /> 
    <property name="maxStatements" value="50" /> <!-- I tried this value = 0 it does not work --> 
    <property name="numHelperThreads" value="1" /> 
</bean> 

DB.properties

hibernate.hbm2ddl.auto=validate 
hibernate.hbm2ddl.import_files=/import_standard.sql 
hibernate.show_sql=false 
hibernate.format_sql=true 
hibernate.generate_statistics=false 
hibernate.use_sql_comments=true 
hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory 
hibernate.cache.use_query_cache=true 
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.SingletonEhCacheRegionFactor 
hibernate.cache.use_second_level_cache=true 

jdbc.driverClassName=com.mysql.jdbc.Driver 
jdbc.url=jdbc:mysql://localhost:3306/asd?autoReconnect=true 
jdbc.username=asd 
jdbc.password=asdasd 

hibernate.dialect=org.hibernate.dialect.MySQL5Dialect 

Ehcahce.xml

<?xml version="1.0" encoding="UTF-8"?> 

<cache 
    name="org.hibernate.cache.UpdateTimestampsCache" 
    maxElementsInMemory="50000" 
    eternal="true" 
    overflowToDisk="true"/> 

<defaultCache 
    maxElementsInMemory="10000" 
    eternal="false" 
    timeToIdleSeconds="120" 
    timeToLiveSeconds="120" 
    overflowToDisk="true" 
    maxElementsOnDisk="10000000" 
    diskPersistent="false" 
    diskExpiryThreadIntervalSeconds="120" 
    memoryStoreEvictionPolicy="LRU"/> 

<cache 
    name="ncStandardElements" 
    maxElementsInMemory="100000" 
    eternal="false" 
    overflowToDisk="true" 
    timeToLiveSeconds="600"/> 

<cache 
    name="ncOrderElements" 
    maxElementsInMemory="100000" 
    eternal="false" 
    overflowToDisk="true" 
    timeToLiveSeconds="60"/> 

<cache 
    name="ncAdminElements" 
    maxElementsInMemory="100000" 
    eternal="false" 
    overflowToDisk="true" 
    timeToLiveSeconds="60"/> 

我是新的Spring和Hibernate,如閱讀文章,這些代碼塊是重要的,應加以管理。如果需要其他代碼塊,請對其進行評論。

+0

應該有更多的堆棧跟蹤上這一點,但我的猜測是,你不必在你的類路徑MySQL的JAR文件。 – nobeh

+0

是的,還有更多的堆棧跟蹤,我只是在這裏寫下錯誤消息。在Maven的依賴關係中有mysql-connector-java-5.1.12.jar – efirat

回答

2

你應該把下面一行到您的數據源豆

<property name="driverClass" value="${jdbc.driverClassName}" /> 
+0

它現在可以工作,但是給我和信息以及另一個錯誤... – efirat

+0

配置是最難的部分.. –

+0

到底!一個應該由所有的方法理論INF ......,我在控制檯消息: '名稱:MySQL的 版本:5.0.96社區-NT 大:5 輕微:0 2013-01- 16 08:02:59,907 INFO [org.hibernate.cfg.SettingsFactory] ​​ - 驅動程序 - > 名稱:MySQL-AB JDBC驅動程序 版本:mysql-connector-java-5.1.12(修訂版:$ {bzr.revision-id }) major:5 minor:1' and 是不是對我很麻煩? – efirat

相關問題