简体   繁体   English

init()中的Atomikos错误:无法获取/var/lib/tomcat6/./tm.out的锁定

[英]Atomikos Error in init(): Couldn't get lock for /var/lib/tomcat6/./tm.out

I need help with a project I'm working on. 我需要帮助处理我正在进行的项目。 It's a web server built with Java spring. 它是使用Java spring构建的Web服务器。 I use Tomcat 6 as web server. 我使用Tomcat 6作为Web服务器。 I switched from MyEclipse For Spring to Eclipse EE and I cannot deploy my web server anymore on my Ubuntu 12.10 64 bit machine. 我从MyEclipse For Spring切换到Eclipse EE,我无法在我的Ubuntu 12.10 64位机器上部署我的Web服务器。

The exception I'm getting is the following: 我得到的例外情况如下:

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atomikosTransactionManager' defined in class path resource [GestioneOneriServlet-dao-context.xml]: Error setting property values; nested exception is     org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionTimeout' threw exception; nested exception is com.atomikos.icatch.SysException: Error in init(): Couldn't get lock for /var/lib/tomcat6/./tm.out
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1251)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612)
at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:558)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested    PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionTimeout' threw exception; nested exception is com.atomikos.icatch.SysException: Error in init(): Couldn't get lock for /var/lib/tomcat6/./tm.out
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
... 33 more

My JTA.properties is as following: 我的JTA.properties如下:

com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory
com.atomikos.icatch.console_file_name = tm.out
com.atomikos.icatch.log_base_name = tmlog
com.atomikos.icatch.tm_unique_name = myeclipseforspring
com.atomikos.icatch.serial_jta_transactions=false
com.atomikos.icatch.automatic_resource_registration=true
com.atomikos.icatch.max_actives=15000
com.atomikos.icatch.max_timeout=3600000
com.atomikos.icatch.enable_logging=false
com.atomikos.icatch.console_log_level=WARN
#com.atomikos.icatch.output_dir=/home/atomikos-sw-tmp/
#com.atomikos.icatch.log_base_dir=/home/atomikos-sw-tmp/

Last two properties are commented as one of the many trials I've done to resolve this error. 最后两个属性被评为我为解决此错误而进行的众多试验之一。

My servlet-dao-context.xml is: 我的servlet-dao-context.xml是:

<!-- Using Atomikos Transaction Manager -->
    <bean class="com.atomikos.icatch.jta.UserTransactionManager" destroy-method="close" id="atomikosTransactionManager" init-method="init">
        <property name="forceShutdown" value="true"/>
        <property name="startupTransactionService" value="true"/>
        <property name="transactionTimeout" value="60"/>
    </bean>
    <bean class="com.atomikos.icatch.jta.UserTransactionImp" id="atomikosUserTransaction"/>
    <!-- Configure the Spring framework to use JTA transactions from Atomikos -->
    <bean class="org.springframework.transaction.jta.JtaTransactionManager" id="transactionManager">
        <property name="transactionManager" ref="atomikosTransactionManager"/>
        <property name="userTransaction" ref="atomikosUserTransaction"/>
        <property name="transactionSynchronizationName" value="SYNCHRONIZATION_ON_ACTUAL_TRANSACTION"/>
    </bean>

I have no idea on how to make this work. 我不知道如何做这项工作。 I don't understand why it searches for the file tm.out in the path /var/lib/tomcat6/./tm.out. 我不明白为什么它在路径/var/lib/tomcat6/./tm.out中搜索文件tm.out。 What does that "/./" stand for? 那个“/./”代表什么?

Please help. 请帮忙。 Andrea 安德里亚

I have had the same issue. 我有同样的问题。 It seems like tomcat is not installing with the correct permissions or I have missed something in the atomikos configuration. 似乎tomcat没有使用正确的权限进行安装,或者我在atomikos配置中遗漏了一些内容。

On my installation /var/lib/tomcat6 is permissioned as 'root' whereas all of the other sub-directories are 'tomcat6'. 在我的安装上/ var / lib / tomcat6被许可为'root',而所有其他子目录都是'tomcat6'。 As tomcat runs as user tomcat6, it cannot create the file. 由于tomcat以用户tomcat6身份运行,因此无法创建该文件。

I changed the owner of /var/lib/tomcat6 directory to tomcat6 and all works fine with no issue. 我将/ var / lib / tomcat6目录的所有者更改为tomcat6,一切正常,没有问题。 I assume that atomikos is expecting something to give it a sub directory of the tomcat directory, but this is set to '.' 我假设atomikos期望给它一个tomcat目录的子目录,但这被设置为'。' (which means the current directory on its own or the present directory if it forms part of a path, like '..' means the parent directory). (这意味着当前目录本身或当前目录,如果它构成路径的一部分,如'..'表示父目录)。 Hence it is actually $TOMCAT_HOME/{atomikos-dir}/tm.out 因此它实际上是$ TOMCAT_HOME / {atomikos-dir} /tm.out

If you can find out where to change '.' 如果你能找到改变的地方'。' to something better, then this would avoid the directory permissions issue (and if you do I would suggest changing it back at a later stage!) 为了更好的东西,那么这将避免目录权限问题(如果你这样做,我会建议在以后更改它!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM