将Grails 2.0.4部署到Glassfish 3.1.2服务器时出错

时间:2012-06-12 16:45:45

标签: grails spring-security glassfish

我正在使用Spring Security Core 1.2.7.3插件,并在尝试部署时遇到此错误:

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 个答案:

答案 0 :(得分:1)

检查您的DataSource.groovy,很可能是production关闭时出现问题。当您在NetBeans中运行时,您可能正在使用开发环境,但在构建战争时,Grails使用生产环境。您可以尝试在IDE中设置-Dgrails.env=production标志,以查看是否遇到了同样的问题。如果它有效,你就知道它是Glassfish的一个问题,如果它失败你就会知道你的环境配置有问题。

修改

尝试将此添加到生产关闭中:

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

或者适用于您的Oracle版本的任何方言。