DB2 JDBC 驱动在Tomcat7 下报错的问题
?
一个简单工程在tomcat6和Jetty下运行都没有问题,但在Tomcat7下启动报错如下:
?
八月 06, 2012 4:54:24 下午 org.apache.catalina.core.ContainerBase addChildInternal
严重: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:Failed to start component[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/qhbiurc]]
???????? atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
???????? atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
???????? atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
???????? atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
???????? atorg.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
???????? atorg.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
???????? atjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
???????? atjava.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
???????? atjava.util.concurrent.FutureTask.run(FutureTask.java:166)
???????? atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
???????? atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
???????? atjava.lang.Thread.run(Thread.java:722)
Caused by:org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java.class file
???????? atorg.apache.tomcat.util.bcel.classfile.ClassParser.readID(ClassParser.java:238)
???????? atorg.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:114)
???????? atorg.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1972)
???????? atorg.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1863)
???????? atorg.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1831)
???????? atorg.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1817)
???????? atorg.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1218)
???????? atorg.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
???????? atorg.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
???????? atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
???????? atorg.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
???????? atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
???????? atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
???????? ...11 more
?
八月 06, 2012 4:54:24 下午 org.apache.catalina.startup.HostConfig deployDescriptor
严重: Error deploying configuration descriptorD:\software\apache-tomcat-7.0.25\conf\Catalina\localhost\qhbiurc.xml
java.lang.IllegalStateException:ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failedto start component[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/qhbiurc]]
???????? atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:900)
???????? atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
???????? atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
???????? atorg.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
???????? atorg.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
???????? atjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
???????? atjava.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
???????? atjava.util.concurrent.FutureTask.run(FutureTask.java:166)
???????? atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
???????? atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
???????? atjava.lang.Thread.run(Thread.java:722)
?
?
Google一下“org.apache.tomcat.util.bcel.classfile.ClassFormatException:null is not a Java .class file”
第一个结果就是http://stackoverflow.com/questions/8685768/including-db2jcc4-in-tomcat-7
?
在$TOMCAT_HOME/conf/catalina.properties
文件
?的tomcat.util.scan.DefaultJarScanner.jarsToSkip
中添加
DB2
驱动的
Jar
包文件名如
”
db2jcc4.jar”
即可。
至于为什么报错,没时间研究了,先把问题解决了。