We are seeing the same as described at Strange Atomikos exception - Error in init(): Log already in use? except we've followed the documentation and specified a logging directory and base name as -D parameters. In our case it's a war file deployed into a naive Tomcat7 container instance.
There is no evidence in the log that the system properties are being read.
This is with 3.9.3 of Atomikos.
tomcat7 11466 2.5 0.7 2311632 257256 ? Sl 09:13 0:19 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomca 7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Dserver.properties.file=/usr/share/tomcat7/server-internal.properties -Dcom.atomikos.icatch.log_base_dir=/var/log/tomcat7/ -Dcom.atomikos.icatch.log_base_name=rest-tm -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
The stacktrace:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.transaction.TransactionManager]: Factory method 'atomikosTransactionManager' threw exception; nested exception is java.lang.IllegalStateException: Can't overwrite cause with java.lang.RuntimeException: Log already in use? at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591) ... 44 more Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.RuntimeException: Log already in use? at java.lang.Throwable.initCause(Throwable.java:456) at com.atomikos.icatch.standalone.UserTransactionServiceImp.init(UserTransactionServiceImp.java:326) at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:405) at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:569) at com.atomikos.icatch.jta.UserTransactionManager.startupTransactionService(UserTransactionManager.java:89) at com.atomikos.icatch.jta.UserTransactionManager.checkSetup(UserTransactionManager.java:77) at com.atomikos.icatch.jta.UserTransactionManager.setTransactionTimeout(UserTransactionManager.java:237) at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig.atomikosTransactionManager(AtomikosTransactionManagerConfig.java:29) at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd.CGLIB$atomikosTransactionManager$0() at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd$$FastClassBySpringCGLIB$$10e69a5.invoke() at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312) at com.foo.springcontainer.config.persistence.transactionmanager.AtomikosTransactionManagerConfig$$EnhancerBySpringCGLIB$$beea75cd.atomikosTransactionManager() at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ... 45 more Caused by: com.atomikos.icatch.SysException: Error in init(): Log already in use? ... 62 more Caused by: java.lang.RuntimeException: Log already in use? at com.atomikos.icatch.standalone.UserTransactionServiceImp.createDefault(UserTransactionServiceImp.java:203) at com.atomikos.icatch.standalone.UserTransactionServiceImp.init(UserTransactionServiceImp.java:258)
I have no idea where I'm supposed to go at this point - I might have hoped that whatever file-name it was trying to open would have been included in the logs but I'm flying blind. There is no file created inside /var/log/tomcat7 except the usual catalina and localhost logs.
Ideas?
That's because the application hasn't closed cleanly and it left some residual log locks that then prevent it from starting.
You'll need to find the
tmlogs
folder of your application. Under that, you'll find an.epoch
file and a.lck
file. Delete those and your application should start up fine.