2013-05-30 15 views
0

我已經部署了一個grails應用程序到tomcat容器,但我沒有合適的驅動程序異常:任何人都可以幫助解決這個問題。沒有合適的驅動程序異常,而聖盃雄貓部署

SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoader Listener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'h ibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationExc eption: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxxx:oracle://xxxxx:1521;ServiceName=xxxx'> 

     at org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator.postProcessBeanFactory(PersistenceContextInterce ptorAggregator.groovy:104) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve refe rence to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframewo rk.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons .dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxxx:oracle://xxxx :1521;xxxx=xxxx' 
     ... 1 more 


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init meth od failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exc eption is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:in formatica:oracle://xxxx:1521;xxx=xxx' 
     ... 1 more 


Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache .commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxx:oracle://xxxx:1521;xxxx=xxxx' 
     ... 1 more 


Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc: xxxx:oracle://xxxx:1521;xxxx=xxxx' 
     at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) 
     at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) 
     at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) 
     ... 1 more Caused by: java.sql.SQLException: No suitable driver 
     at java.sql.DriverManager.getDriver(DriverManager.java:264) 
     at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) 
     ... 3 more 

May 30, 2013 7:31:25 PM org.apache.catalina.core.StandardContext start 
SEVERE: Error listenerStart 
May 30, 2013 7:31:25 PM org.apache.catalina.core.StandardContext start 
SEVERE: Context [/Jarvis] startup failed due to previous errors 
May 30, 2013 7:31:25 PM org.apache.catalina.core.ApplicationContext log 
INFO: Closing Spring root WebApplicationContext 
+0

在嵌入式Tomcat中它適合您嗎? ('grails run-app')。看起來你錯過了對'ojdbc * .jar'的依賴。 – dmahapatro

回答

0

更新的依賴關係定義的例子

以下庫定義添加到您的BuildConfig.groovy

mavenRepo "https://code.lds.org/nexus/content/groups/main-repo" 

在你的依賴部分下面應該出現:

runtime 'com.oracle:ojdbc6:11.2.0.3' 

更好的方法是install manually Oracle驅動程序到您的企業版本庫(Artifactory,Nexus,Archiva,文件服務器等)

+0

我已經添加了oracle ojdbc6-11.2.0.3.jar來構建路徑並從嵌入式的Tomcat? (grails run-app)應用程序加載並運行。如果我創建一個戰爭,然後將其部署到單獨的tomcate然後它會引發上述異常。 – Mohan

+0

如果你按照我的答案的建議,你的問題就會消失。如果添加Maven倉庫對您來說很複雜,請將該驅動程序添加到您的Grails項目的lib文件夾中。 – rimero

相關問題