加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

java – 在tomcat上部署grails应用程序时创建名为’transaction

发布时间:2020-12-15 01:31:21 所属栏目:大数据 来源:网络整理
导读:我试图在tomcat 7.0.42上部署我的grails(2.2.1)应用程序.所以我从grails网站上按照link中给出的步骤进行了操作.但是当我尝试从Tomcat Web应用程序管理器启动应用程序时,我在tomcat控制台上看到以下错误日志: Error creating bean with name 'transactionMan

我试图在tomcat 7.0.42上部署我的grails(2.2.1)应用程序.所以我从grails网站上按照link中给出的步骤进行了操作.但是当我尝试从Tomcat Web应用程序管理器启动应用程序时,我在tomcat控制台上看到以下错误日志:

    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.fa
ctory.BeanCreationException: 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.springframew
ork.beans.factory.BeanCreationException: Error creating bean with name 'dialectD
etector': Invocation of init method failed; nested exception is org.springframew
ork.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaDat
a; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create
 PoolableConnectionFactory (Database may be already in use: "Locked by another p
rocess". Possible solutions: close all other connection(s); use the server mode
[90020-164])
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h 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 'sess
ionFactory' while setting bean property 'sessionFactory'; nested exception is or
g.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' wh
ile setting bean property 'hibernateProperties'; nested exception is org.springf
ramework.beans.factory.BeanCreationException: Error creating bean with name 'hib
ernateProperties': Cannot resolve reference to bean 'dialectDetector' while sett
ing bean property 'properties' with key [hibernate.dialect]; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error creating bean wi
th name 'dialectDetector': Invocation of init method failed; nested exception is
 org.springframework.jdbc.support.MetaDataAccessException: Error while extractin
g DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedExcepti
on: Cannot create PoolableConnectionFactory (Database may be already in use: "Lo
cked by another process". Possible solutions: close all other connection(s); use
 the server mode [90020-164])
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'transactionManager': Cannot resolve reference to bean 'sessio
nFactory' while setting bean property 'sessionFactory'; nested exception is org.
springframework.beans.factory.BeanCreationException: Error creating bean with na
me 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' whil
e setting bean property 'hibernateProperties'; nested exception is org.springfra
mework.beans.factory.BeanCreationException: Error creating bean with name 'hiber
nateProperties': Cannot resolve reference to bean 'dialectDetector' while settin
g bean property 'properties' with key [hibernate.dialect]; nested exception is o
rg.springframework.beans.factory.BeanCreationException: Error creating bean with
 name 'dialectDetector': Invocation of init method failed; nested exception is o
rg.springframework.jdbc.support.MetaDataAccessException: Error while extracting
DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException
: Cannot create PoolableConnectionFactory (Database may be already in use: "Lock
ed by another process". Possible solutions: close all other connection(s); use t
he server mode [90020-164])
        ... 3 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateP
roperties' while setting bean property 'hibernateProperties'; nested exception i
s org.springframework.beans.factory.BeanCreationException: Error creating bean w
ith name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetecto
r' while setting bean property 'properties' with key [hibernate.dialect]; nested
 exception is org.springframework.beans.factory.BeanCreationException: Error cre
ating bean with name 'dialectDetector': Invocation of init method failed; nested
 exception is org.springframework.jdbc.support.MetaDataAccessException: Error wh
ile extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQL
NestedException: Cannot create PoolableConnectionFactory (Database may be alread
y in use: "Locked by another process". Possible solutions: close all other conne
ction(s); use the server mode [90020-164])
        ... 3 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'hibernateProperties': Cannot resolve reference to bean 'diale
ctDetector' 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 faile
d; nested exception is org.springframework.jdbc.support.MetaDataAccessException:
 Error while extracting DatabaseMetaData; nested exception is org.apache.commons
.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Database may
be already in use: "Locked by another process". Possible solutions: close all ot
her connection(s); use the server mode [90020-164])
        ... 3 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'dialectDetector': Invocation of init method failed; nested ex
ception is org.springframework.jdbc.support.MetaDataAccessException: Error while
 extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNes
tedException: Cannot create PoolableConnectionFactory (Database may be already i
n use: "Locked by another process". Possible solutions: close all other connecti
on(s); use the server mode [90020-164])
        ... 3 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while
 extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNes
tedException: Cannot create PoolableConnectionFactory (Database may be already i
n use: "Locked by another process". Possible solutions: close all other connecti
on(s); use the server mode [90020-164])
        ... 3 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableCon
nectionFactory (Database may be already in use: "Locked by another process". Pos
sible solutions: close all other connection(s); use the server mode [90020-164])

        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFacto
ry(BasicDataSource.java:1549)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:1388)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:1044)
        ... 3 more
Caused by: org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked
 by another process". Possible solutions: close all other connection(s); use the
 server mode [90020-164]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
        at org.h2.message.DbException.get(DbException.java:169)
        at org.h2.message.DbException.get(DbException.java:146)
        at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:439)
        at org.h2.store.FileLock.lockFile(FileLock.java:336)
        at org.h2.store.FileLock.lock(FileLock.java:128)
        at org.h2.engine.Database.open(Database.java:542)
        at org.h2.engine.Database.openDatabase(Database.java:222)
        at org.h2.engine.Database.

当通过run-app命令运行时(在intellij中)应用程序运行正常.

此外,如果我们从日志中看到这一行:无法创建PoolableConnectionFactory(数据库可能已在使用:“被另一个进程锁定”.可能的解决方案:关闭所有其他连接;使用服务器模式[90020-164]),它说数据库正被其他一些进程使用.但是,这不可能发生,因为数据库是HSQLDB,它是grails应用程序的内部,并且没有使用其他外部DBMS.

我肯定会赞成(并且也接受,如果它是最终的)解决上述问题(或至少给出解决方向)的任何解决方案.

编辑:
这是我的DataSource.groovy

dataSource {
    pooled = true
    driverClassName = "org.h2.Driver"
    username = "sa"
    password = ""
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "update" // one of 'create','create-drop','update','validate',''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"

        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:file:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
            pooled = true
            properties {
               maxActive = -1
               minEvictableIdleTimeMillis=1800000
               timeBetweenEvictionRunsMillis=1800000
               numTestsPerEvictionRun=3
               testOnBorrow=true
               testWhileIdle=true
               testOnReturn=true
               validationQuery="SELECT 1"
            }
        }
    }
}
最佳答案
url = "jdbc:h2:file:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"

指的是H2文件数据库.你是否可以尝试在内存prodDb中使用,如果意图不是要引用文件数据库?

url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读