今天用maven建立web 工程,分别用Tomcat6,Tomcat7启动,都报错org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool。最后换成Tomcat8,启动项目就好了,这应该是tomcat 的一个缺陷。解决问题就是换成高版本的Tomcat8,即可。
Tomcat7 报错信息如下:
四月 22, 2017 10:08:23 下午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_121\bin;C:\D\MyEclipse\tomcat7\apache-tomcat-7.0.8\bin
四月 22, 2017 10:08:24 下午 org.apache.coyote.AbstractProtocolHandler init
信息: Initializing ProtocolHandler [“http-bio-8080”]
四月 22, 2017 10:08:24 下午 org.apache.coyote.AbstractProtocolHandler init
信息: Initializing ProtocolHandler [“ajp-bio-8009”]
四月 22, 2017 10:08:24 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3567 ms
四月 22, 2017 10:08:24 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
四月 22, 2017 10:08:24 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.8
四月 22, 2017 10:08:24 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
四月 22, 2017 10:08:26 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
四月 22, 2017 10:08:28 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
四月 22, 2017 10:08:28 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
四月 22, 2017 10:08:28 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory HelloMaven
四月 22, 2017 10:08:28 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(C:\D\MyEclipse\tomcat7\apache-tomcat-7.0.8\webapps\HelloMaven\WEB-INF\lib\javaee-api-7.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
四月 22, 2017 10:08:28 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(C:\D\MyEclipse\tomcat7\apache-tomcat-7.0.8\webapps\HelloMaven\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
四月 22, 2017 10:08:29 下午 org.apache.catalina.startup.HostConfig deployDirectory
严重: Error deploying web application directory HelloMaven
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.(ConstantPool.java:60)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1908)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1797)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1756)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1742)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1245)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:343)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:323)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
四月 22, 2017 10:08:29 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory host-manager
四月 22, 2017 10:08:29 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory manager
四月 22, 2017 10:08:30 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
四月 22, 2017 10:08:30 下午 org.apache.coyote.AbstractProtocolHandler start
信息: Starting ProtocolHandler [“http-bio-8080”]
四月 22, 2017 10:08:30 下午 org.apache.coyote.AbstractProtocolHandler start
信息: Starting ProtocolHandler [“ajp-bio-8009”]
四月 22, 2017 10:08:30 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 5748 ms
tomcat 8 启动信息如下
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/8.0.43
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Mar 28 2017 14:42:59 UTC
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 8.0.43.0
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jdk1.8.0_121\jre
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_121-b13
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: C:\D\tomcat\apache-tomcat-8.0.43
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: C:\D\tomcat\apache-tomcat-8.0.43
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=C:\D\tomcat\apache-tomcat-8.0.43
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=C:\D\tomcat\apache-tomcat-8.0.43
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=C:\D\tomcat\apache-tomcat-8.0.43/common/endorsed
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=C:\D\tomcat\apache-tomcat-8.0.43\temp
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\Program Files\Java\jdk1.8.0_121\bin;C:\D\tomcat\apache-tomcat-8.0.43\bin
四月 22, 2017 10:18:28 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dsun.io.useCanonCaches=false
四月 22, 2017 10:18:28 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_121\bin;C:\D\tomcat\apache-tomcat-8.0.43\bin
四月 22, 2017 10:18:29 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler [“http-nio-8080”]
四月 22, 2017 10:18:30 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
四月 22, 2017 10:18:30 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler [“ajp-nio-8009”]
四月 22, 2017 10:18:30 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
四月 22, 2017 10:18:30 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 4964 ms
四月 22, 2017 10:18:30 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
四月 22, 2017 10:18:30 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.43
四月 22, 2017 10:18:30 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\docs
四月 22, 2017 10:18:32 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\docs has finished in 1,979 ms
四月 22, 2017 10:18:32 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\examples
四月 22, 2017 10:18:35 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
四月 22, 2017 10:18:35 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
四月 22, 2017 10:18:35 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\examples has finished in 2,446 ms
四月 22, 2017 10:18:35 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\HelloMaven
四月 22, 2017 10:18:38 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
四月 22, 2017 10:18:38 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\HelloMaven has finished in 3,452 ms
四月 22, 2017 10:18:38 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\host-manager
四月 22, 2017 10:18:38 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\host-manager has finished in 148 ms
四月 22, 2017 10:18:38 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\manager
四月 22, 2017 10:18:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\manager has finished in 183 ms
四月 22, 2017 10:18:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\ROOT
四月 22, 2017 10:18:39 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\D\tomcat\apache-tomcat-8.0.43\webapps\ROOT has finished in 242 ms
四月 22, 2017 10:18:39 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [“http-nio-8080”]
四月 22, 2017 10:18:39 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [“ajp-nio-8009”]
四月 22, 2017 10:18:39 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 8863 ms