eclipse上启动的tomcat可以热部署吗
求大神分析分析
tomcat版本:apache-tomcat-6.0.35
我怀疑多半是工程的问题,可是我找不出原因,以前我做的web项目,都支持热部署的,java类修改后,会自动生效,不用重启服务器,很方便。可是最近这个项目,随便修改一点java代码,比如就是在方法里加一个空白行,tomcat都会自动重启,最恶心的是,重启还总是报错,停在WebappClassLoader.loaderClass,还找不到源文件,最后报以下错误:
2013-2-20 10:44:29 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already. Could not load org.apache.mina.util.SessionLog. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:348)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
at org.apache.mina.common.IoFilterAdapter.exceptionCaught(IoFilterAdapter.java:75)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
at org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.exceptionCaught(AbstractIoFilterChain.java:494)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
at org.apache.mina.common.support.AbstractIoFilterChain.fireExceptionCaught(AbstractIoFilterChain.java:334)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextSessionIdle(AbstractIoFilterChain.java:287)
at org.apache.mina.common.support.AbstractIoFilterChain.access$900(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.sessionIdle(AbstractIoFilterChain.java:638)
at org.apache.mina.common.IoFilterAdapter.sessionIdle(IoFilterAdapter.java:70)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextSessionIdle(AbstractIoFilterChain.java:284)
at org.apache.mina.common.support.AbstractIoFilterChain.access$900(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.sessionIdle(AbstractIoFilterChain.java:638)
at org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.sessionIdle(AbstractIoFilterChain.java:489)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextSessionIdle(AbstractIoFilterChain.java:284)
at org.apache.mina.common.support.AbstractIoFilterChain.fireSessionIdle(AbstractIoFilterChain.java:278)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.notifyIdleness0(SocketIoProcessor.java:289)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.notifyIdleness(SocketIoProcessor.java:271)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.notifyIdleness(SocketIoProcessor.java:260)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$700(SocketIoProcessor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:490)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2013-2-20 10:44:29 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already. Could not load org.apache.mina.common.ExceptionMonitor. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:512)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "ConfigClientWorker-Default" java.lang.NoClassDefFoundError: org/apache/log4j/spi/VectorWriter
at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.error(Category.java:319)
at com.taobao.config.client.ConfigClientWorker$WorkerThread.run(ConfigClientWorker.java:268)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.spi.VectorWriter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 4 more
Exception in thread "LOGSTAT-WRITE" java.lang.NullPointerException
at com.taobao.logstat.StatLog.writeLog(StatLog.java:190)
at com.taobao.logstat.StatLog.access$300(StatLog.java:33)
at com.taobao.logstat.StatLog$1.run(StatLog.java:156)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "thread-2" java.lang.NoClassDefFoundError: org/apache/mina/common/ExceptionMonitor
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:512)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.mina.common.ExceptionMonitor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 5 more
看看eclipse是不是配置了多个版本的JDK。 应该是容器的问题吧,把项目重新导入进你的eclipse里面,然后再启动下看? Servers 中的 server.xml文件 打开 拖到最后 修改
<Context docBase="test" path="/test" reloadable="false" source="org.eclipse.jst.jee.server:t8"/></Host>
改成reloadable="false"后,问题就解决了