2014-10-08 65 views
0

我試圖讓我的grails應用程序在本地運行tomcat,但沒有在/ lib中放置ojdbc6.jar。我的grails應用程序被部署到Glassfish上,並在服務器上正常工作(因爲ojdbc6.jar在那裏可用)。正如預期的錯誤是:Grails - 如何將Oracle jdbc jar添加到類路徑而不放置在/ lib中?

Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver] 

(失敗)方法#1

我第一次定製我的GGTS運行配置包括VM參數:

-cp :/somelocalpath/oracle-jdbc-drivers 

但錯誤依然存在。

(失敗)方法2

我目前正在使用jvmArgs指向罐子的本地版本。

grails.tomcat.jvmArgs = ["-cp:/somelocalpath/oracle-jdbc-drivers/ojdbc6.jar"] 

然而,在運行戰爭結果:

| Error Server failed to start: tomcat exited prematurely with code '1' (error output: 'Unrecognized option: -cp:/apps/glassfish3/oracle-jdbc-drivers/ojdbc6.jar 
Error: Could not create the Java Virtual Machine. 
Error: A fatal exception has occurred. Program will exit. 
') 

我要澄清我的主要焦點 - 我不希望被包含在最終的戰爭罐子。

任何幫助,將不勝感激。謝謝!

回答

0

documentation

grails.war.resources讓你做你想做 終於創建的WAR文件之前,任何額外的處理。

在你的情況下,你需要添加類似的東西到你的構建配置,以排除最後的WAR的Jar。

grails.war.resources = { stagingDir -> 
    delete(file:"${ stagingDir }/WEB-INF/lib/yourJarFile.jar") 
} 
+0

這正是我最終使用的! – bigfatony 2014-10-08 19:48:34

相關問題