Reputation: 271
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:232)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:188)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1335)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java:1391)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1172)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1340)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:550)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:630)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:365)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:688)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:667)
at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:296)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:118)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:168)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2379)
at org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference.internalResolveLeafType(ParameterizedQualifiedTypeReference.java:138)
at org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference.internalResolveType(ParameterizedQualifiedTypeReference.java:132)
at org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference.resolveType(ParameterizedQualifiedTypeReference.java:351)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:1374)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:699)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:677)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:469)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:756)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:468)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:459)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I am using Apache Tomcat/7.0.33, eclipse-jee-kepler-SR1-RC3-win32
Upvotes: 27
Views: 67550
Reputation: 849
If you got here using something a little more modern (I was updating a project from java8 to java17), upgrading jasper, itext and poi from the old version to the new version did the trick for me.
Upvotes: 0
Reputation: 985
I hope the following steps will solve your problem.
1) Stop the tomcat.
2) Download ecj-4.2.2.jar in this link
3) Copy ecj-4.2.2.jar under tomcat's lib folder (example - C:\apache-tomcat-6.0.36\lib).
4) Rename ecj-3.7.2.jar to old_ecj-3.7.2.jar.
5) Start the tomcat.
Upvotes: 11
Reputation: 281
Thanks much for the tips! Ran into same ClassFormatException error on Tomcat 6.0.20 and JDK1.8. Replaced the jasper-jdt.jar with ecj-4.2.2.jar and all the JSPs compiling/working again.
Upvotes: 28
Reputation: 1
This Problem is caused due to compatibility issue with jdk, tomcat and Eclipse. For resolving this problem use jdk ver 1.8 with apache tomcat 8.0 and updated Eclipse Mars 2.0.
I have the same problem with Apache Tomcat 7.0.
Reconfigure all and your problem will be solved.
Upvotes: 0
Reputation: 153
Note that 1. We cannot update the version of ECJ included with Tomcat 6, as Tomcat 6 must be able to run on Java 1.5, but current ECJ releases require minimum of Java 6.
See archives of Tomcat Users mailing list, and ask on the mailing list if you have questions. (Bugzilla is not a support forum).
Upvotes: 0
Reputation: 153
i also faced same problem after searching many article i could found this solution
which version of Tomcat you are using.
Second, for Java 8 you have to use a version of Eclipse ECJ compiler that supports Java 8.
The "ClassFormatException" probably means that your version of ECJ does not know about Java 8 at all.
change the jre new version to old version because it doesn't support to this tomcat version
Upvotes: 0
Reputation: 19
Check Your Tomcat Version.If your tomcat version 7.0.29 and below then Remove your Old Tomcat and Download latest one . And run the project https://tomcat.apache.org/download-90.cgi
Upvotes: 2
Reputation: 1002
I had the same problem using Tomcat 6 with Java 8. I solved it by configuring Tomcat to use Java 7 instead of 8: Add export JAVA_HOME=/usr/lib/jvm/java-7-oracle
in your {tomcat-home}/bin/catalina.sh
or your custom startup script.
Upvotes: 1
Reputation: 2183
The problem is related to ecj version (ecj-3.7.2.jar), you have to use a more recent version of tomcat compatible with jdk8 (apache-tomcat-7.0.68 works fine for me )
Upvotes: 13
Reputation: 2026
If you use maven and jdk8 to start tomcat7, make sure that the version of the tomcat7-maven-plugin
is at least 2.2
Upvotes: 5
Reputation: 128
Going by the information in the stack trace, it seems that there is a compilation problem with the built in eclipse compiler which it uses rather than javac. All the Luna builds of Eclipse have support for jdk 8 but as you have mentioned that you are using Eclipse Kepler, you would have to download a feature patch from the eclipse community itself in order to support jdk 8.
Meanwhile you can you use jdk 7 and recompile your project. See if the error goes away. Apart from that the code looks fine to me. I hope it helps. Happy to help.
Upvotes: 1
Reputation: 634
Remove existing localhost servers and add new server. This will solve your problem.
Upvotes: 2
Reputation: 1275
If you is using java 8 maybe you should update your eclipse version.
Upvotes: 1