tomcat部署war出错的问题
昨天我部署和测试我打的一个包,结果总是报错,错误信息如下:
信息: Deploying web application archive zjmap.war
2011-10-12 9:07:09 org.apache.catalina.core.ContainerBase addChildInternal
严重: ContainerBase.addChild: start:
LifecycleException: Error initializaing : java.lang.NullPointerException
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4380)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
2011-10-12 9:07:09 org.apache.catalina.startup.HostConfig deployWAR
严重: Error deploying web application archive zjmap.war
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException: Error initializaing : java.lang.NullPointerException
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:795)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
看问题是空指针异常,可是我又无法追踪错误所在,忙活了很久没有结果,就放一边了。早上过来了还是要干活啊,所以又拾起那个问题。分析一二觉得有可能是ant打包的问题,可是我又无法确定。于是我断开svn,使用MyEclipse打包工具,打包—》部署—正常部署运行,看来真是打包的问题。哥于是带着眼镜啃骨头,终于找到了。原来在打包的过程中环境变量设置时没有把该用的jar包引入,居然还编译通过,怪哉!因为我的程序使用了jaxb-2.1的东西,而我的jdk内置的是2.0的api。问题找到了,加一个引入的设置:
<fileset dir="lib/jaxb" includes="**/*.jar"/>
打包(ant)—》部署—》正常运行!耶!看来ant打包不是很完美啊,也可能是哥太粗心了!嘿嘿!