当我通过停止tomcat来停止我的web应用程序时,neo4j db并没有干净地关闭。我总是得到以下异常,neo4j在下一个应用程序启动时进行数据库恢复。
应用程序在嵌入模式下使用neo4j运行,并使用spring-data-neo4j 2.0,Java 1.7.0_11-b21和apache-tomcat-7.0.34。
有人可以帮忙吗?
Jan 23, 2013 6:13:52 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Unable to close logical log
java.nio.channels.ClosedByInterruptException
at java.nio.channels.spi.AbstractInterruptibleChannel .end(AbstractInterruptibleChannel.java:202)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.j ava:705)
at org.neo4j.kernel.impl.transaction.xaframework.Dire ctMappedLogBuffer.writeOut(DirectMappedLogBuffer.j ava:159)
at org.neo4j.kernel.impl.transaction.xaframework.Dire ctMappedLogBuffer.force(DirectMappedLogBuffer.java :172)
at org.neo4j.kernel.impl.transaction.xaframework.XaLo gicalLog.releaseCurrentLogFile(XaLogicalLog.java:6 77)
at org.neo4j.kernel.impl.transaction.xaframework.XaLo gicalLog.close(XaLogicalLog.java:702)
at org.neo4j.kernel.impl.transaction.xaframework.XaCo ntainer.close(XaContainer.java:76)
at org.neo4j.index.impl.lucene.LuceneDataSource.close (LuceneDataSource.java:318)
at org.neo4j.kernel.impl.transaction.XaDataSourceMana ger.shutdown(XaDataSourceManager.java:106)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleIn stance.shutdown(LifeSupport.java:443)
at org.neo4j.kernel.lifecycle.LifeSupport.shutdown(Li feSupport.java:211)
at org.neo4j.kernel.InternalAbstractGraphDatabase.shu tdown(InternalAbstractGraphDatabase.java:574)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.Disposab leBeanAdapter.invokeCustomDestroyMethod(Disposable BeanAdapter.java:320)
at org.springframework.beans.factory.support.Disposab leBeanAdapter.destroy(DisposableBeanAdapter.java:2 46)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroyBean(DefaultSingletonB eanRegistry.java:510)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroySingleton(DefaultSingl etonBeanRegistry.java:486)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroySingletons(DefaultSing letonBeanRegistry.java:455)
at org.springframework.context.support.AbstractApplic ationContext.destroyBeans(AbstractApplicationConte xt.java:1090)
at org.springframework.context.support.AbstractApplic ationContext.doClose(AbstractApplicationContext.ja va:1064)
at org.springframework.context.support.AbstractApplic ationContext.close(AbstractApplicationContext.java :1010)
at org.springframework.web.context.ContextLoader.clos eWebApplicationContext(ContextLoader.java:549)
at org.springframework.web.context.ContextLoaderListe ner.contextDestroyed(ContextLoaderListener.java:14 3)
at org.apache.catalina.core.StandardContext.listenerS top(StandardContext.java:4831)
at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext.java:5478)
at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.c all(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StopChild.c all(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.jav a:166)
at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.jav a:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
答案 0 :(得分:0)
也许Tomcat有时会中断执行线程。 Neo4j使用Java NIO,它对中断非常敏感并且会引起这样的问题,因为当它注意到使用I / O的线程被中断时它将立即关闭该文件句柄。