在tomcat 8上部署grails app时出错

时间:2016-06-08 12:00:13

标签: hibernate tomcat grails

我只是grails应用程序,而我试图在tomcat上使用我的应用程序部署war文件我会重现这些错误,只是其中的一部分

Configuring Spring Security Core ...
... finished configuring Spring Security Core


Configuring Spring Security LDAP ...
... finished configuring Spring Security LDAP

ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor'
: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error crea
ting bean with name 'transactionManager': Cannot resolve reference to bean 'transactionManager_test' while setting const
ructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creatin
g bean with name 'transactionManager_test': Cannot resolve reference to bean 'sessionFactory_test' while setting bean pr
operty 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bea
n with name 'sessionFactory_test': Invocation of init method failed; nested exception is org.hibernate.service.spi.Servi
ceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcesso
rRegistrationDelegate.java:207)
        at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplication
Context.java:687)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:118)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
        at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
        at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
        at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitiali
zer.groovy:57)
        at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java
:85)
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:16
9)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5244)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager':
Cannot resolve reference to bean 'transactionManager_test' while setting constructor argument with key [1]; nested excep
tion is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_test'
: Cannot resolve reference to bean 'sessionFactory_test' while setting bean property 'sessionFactory'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_test': Invocat
ion of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested se
rvice [org.hibernate.engine.spi.CacheImplementor]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueRes
olver.java:359)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionV
alueResolver.java:108)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueR
esolver.java:382)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionV
alueResolver.java:157)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver
.java:634)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:14
0)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAuto
wireCapableBeanFactory.java:1143)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutow
ireCapableBeanFactory.java:1046)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:510)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.grails.transaction.TransactionManagerPostProcessor.initialize(TransactionManagerPostProcessor.java:75)
        at org.grails.transaction.TransactionManagerPostProcessor.setBeanFactory(TransactionManagerPostProcessor.java:53
)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutow
ireCapableBeanFactory.java:1597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1565)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:545)
        ... 29 common frames omitted

,这是我的application.yml file

#server:
#    'contextPath': '/Base'

grails:
    profile: web
    codegen:
        defaultPackage: baseapp
    plugin:
      springsecurity:
         ldap:
            context:
               managerDn: 'CN=cn,OU=ou,OU=ou2,OU=ou3,DC=dc,DC=dc1'
               managerPassword: pwd
               server: 'ldaps://server-adress.with.porth:636'
            authorities:
               groupSearchBase: 'OU=ou,DC=dc,DC=dc1'
               prefix: 'ROLE_'
               defaultRole: 'ADMIN'
               retrieveGroupRoles: false
               retrieveDatabaseRoles: true
            search:
               base: 'OU=ou,DC=dc,DC=dc1'
               filter: '(sAMAccountName={0})'
            mapper:
                userDetailsClass: 'baseapp.BaseAppUserDetails'
info:
    app:
        name: '@info.app.name@'
        version: '@info.app.version@'
        grailsVersion: '@info.app.grailsVersion@'
spring:
    groovy:
        template:
            check-template-location: false

---
grails:
    mime:
        disable:
            accept:
                header:
                    userAgents:
                        - Gecko
                        - WebKit
                        - Presto
                        - Trident
        types:
            all: '*/*'
            atom: application/atom+xml
            css: text/css
            csv: text/csv
            form: application/x-www-form-urlencoded
            html:
              - text/html
              - application/xhtml+xml
            js: text/javascript
            json:
              - application/json
              - text/json
            multipartForm: multipart/form-data
            pdf: application/pdf
            rss: application/rss+xml
            text: text/plain
            hal:
              - application/hal+json
              - application/hal+xml
            xml:
              - text/xml
              - application/xml
    urlmapping:
        cache:
            maxsize: 1000
    controllers:
        defaultScope: singleton
    converters:
        encoding: UTF-8
    views:
        default:
            codec: html
        gsp:
            encoding: UTF-8
            htmlcodec: xml
            codecs:
                expression: html
                scriptlets: html
                taglib: none
                staticparts: none
---

hibernate:
    cache:
        queries: false
        use_second_level_cache: true
        use_query_cache: false
        region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'

endpoints:
    jmx:
        unique-names: true
dataSources:
    ami:
        pooled: true
        dialect: org.hibernate.dialect.Oracle10gDialect
        url: jdbc:oracle:thin:@10.11.12.13:1521/raz
        driverClassName: oracle.jdbc.OracleDriver
        logSql: true
        username: usr
        password: pwd
        properties:
            jmxEnabled: true
            initialSize: 5
            maxActive: 50
            minIdle: 5
            maxIdle: 25
            maxWait: 10000
            maxAge: 600000
            timeBetweenEvictionRunsMillis: 5000
            minEvictableIdleTimeMillis: 60000
            validationQuery: "SELECT 1 FROM DUAL"
            validationQueryTimeout: 3
            validationInterval: 15000
            testOnBorrow: true
            testWhileIdle: true
            testOnReturn: false
            jdbcInterceptors: ConnectionState
            defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
    mr:
        pooled: true
        dialect: org.hibernate.dialect.Oracle10gDialect
        url: jdbc:oracle:thin:@10.11.12.14:1521:zar
        logSql: true
        driverClassName: oracle.jdbc.OracleDriver
        username: usr
        password: pwd
        properties:
            jmxEnabled: true
            initialSize: 5
            maxActive: 50
            minIdle: 5
            maxIdle: 25
            maxWait: 10000
            maxAge: 600000
            timeBetweenEvictionRunsMillis: 5000
            minEvictableIdleTimeMillis: 60000
            validationQuery: "SELECT 1 FROM DUAL"
            validationQueryTimeout: 3
            validationInterval: 15000
            testOnBorrow: true
            testWhileIdle: true
            testOnReturn: false
            jdbcInterceptors: ConnectionState
            defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

    test:
        pooled: true
        dialect: org.hibernate.dialect.SQLServerDialect
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
        url: jdbc:sqlserver://10.11.12.15:62767;databaseName=name;integratedSecurity=true
        properties:
            jmxEnabled: true
            initialSize: 5
            maxActive: 50
            minIdle: 5
            maxIdle: 25
            maxWait: 10000
            maxAge: 600000
            timeBetweenEvictionRunsMillis: 5000
            minEvictableIdleTimeMillis: 60000
            validationQuery: "SELECT 1"
            validationQueryTimeout: 3
            validationInterval: 15000
            testOnBorrow: true
            testWhileIdle: true
            testOnReturn: false
            jdbcInterceptors: ConnectionState
            defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
    dataSource:
        pooled: true
        password: pwd
        username: sa
        dialect: org.hibernate.dialect.SQLServerDialect
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
        url: jdbc:sqlserver://10.170.11.16:62767;databaseName=other;integratedSecurity=true
        properties:
            jmxEnabled: true
            initialSize: 5
            maxActive: 50
            minIdle: 5
            maxIdle: 25
            maxWait: 10000
            maxAge: 600000
            timeBetweenEvictionRunsMillis: 5000
            minEvictableIdleTimeMillis: 60000
            validationQuery: "SELECT 1"
            validationQueryTimeout: 3
            validationInterval: 15000
            testOnBorrow: true
            testWhileIdle: true
            testOnReturn: false
            jdbcInterceptors: ConnectionState
            defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

environments:
    development:
        dataSource:
            dbCreate: update
            #logSql: true
            #formatSql: true
            #url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
        test:
            dbCreate: validate
        mr:
            dbCreate: validate
        ami:
            dbCreate: validate
    test:
        dataSource:
            dbCreate: update
            #url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
        test:
            dbCreate: validate
        mr:
            dbCreate: validate
        ami:
            dbCreate: validate
    production:
        dataSource:
            dbCreate: update
            #url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
        test:
            dbCreate: validate
        mr:
            dbCreate: validate
        ami:
            dbCreate: validate

hibernate版本为classpath "org.grails.plugins:hibernate:4.3.10.5" 我的项目是在旧版本的grails 3.x下创建的,我有一些问题,我用最新的grails版本创建了新项目,并移动了所有控制器,域名clases和服务以及所有配置文件。 什么不能成为tomcat这样的错误的原因?我可以说在我的机器上它编译得很好 这里是完整的堆栈跟踪,我的grails版本现在是3.1.8之前的3.1.8 stacktrace

0 个答案:

没有答案