2012-06-12 77 views
1

我使用Spring Security的核心1.2.7.3插件,並正在此錯誤時嘗試部署:錯誤部署Grails的2.0.4到GlassFish 3.1.2服務器

Error occurred during deployment: Exception while loading the app : 
java.lang.IllegalStateException: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'transactionManagerPostProcessor': Initialization of bean failed; nested exception 
is  org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while 
setting bean property 'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting 
bean property 'hibernateProperties'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while  
setting 
bean property 'propertie .... msg.seeServerLog 

應用程序工作正常,當我運行從netbeans內部,但當我嘗試部署它時,我收到錯誤。我已經嘗試清理,並取消BuildConfig.groovy文件中依賴關係中的代碼'mysql:mysql-connector-java:5.1.16'。我正在使用安裝在我的/ lib文件夾內的Oracle jdbc驅動程序。

我猜測這與Oracle jdbc驅動程序沒有找到有關。

更新:我添加下面

production { 
    dataSource { 
     url = "jdbc:oracle:thin:@MYSERVERNAME.com:xxxx:xxxxxxx" 
     pooled = true 
     properties { 
      maxActive = -1 
      minEvictableIdleTimeMillis=1800000 
      timeBetweenEvictionRunsMillis=1800000 
      numTestsPerEvictionRun=3 
      testOnBorrow=true 
      testWhileIdle=true 
      testOnReturn=true 
      validationQuery="SELECT 1" 
     } 
    } 
} 

回答

1

我的停產檢查DataSource.groovy,最有可能有一些錯誤的production關閉。在NetBeans中運行時,您可能使用了開發環境,但是當您構建戰爭時,Grails會使用生產環境。您可以嘗試在IDE內設置-Dgrails.env=production標誌,以查看是否遇到相同的問題。如果它有效,那麼你知道這是Glassfish的一個問題,如果它失敗了,那麼你知道這是你的環境配置的一個問題。

編輯:

嘗試添加以下內容到停產:

driverClassName = "oracle.jdbc.driver.OracleDriver" 
dialect = "org.hibernate.dialect.Oracle10gDialect" 

或任何方言是適合您的Oracle版本。

+0

好吧,我照你說的做了,並在IDE中設置'-Dgrails.env = production flag'時出錯。我編輯了我的原始文章以包括生產關閉。封閉體中是否有可能導致問題的東西? – Universitas

+0

試圖添加這些,它仍然是壞的。也許它比只有Datasource.groovy文件更深? – Universitas

+0

我剛剛註釋掉了Properties {}部分,並試圖運行它 - 它似乎在生產模式下運行OK,一旦我這樣做了。我不明白什麼是閉包屬性,但我認爲這是針對H2數據庫而不是與Oracle jdbc相關的?這似乎是錯誤的原因。我應該爲oracle db的屬性得到什麼? – Universitas