Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » jsp compilation fails with ClassFormatException(Tomcat (using jdt) likes eclipse builds but not ant builds?)
jsp compilation fails with ClassFormatException [message #512922] Mon, 08 February 2010 06:25 Go to next message
Eclipse UserFriend
Hello,

not sure whether here is the right place to post, but i give it a shot...

I have a webapp with JSP's using some classes from WEB-INF/classes in a declaration block (<%!%>),
running in tomcat 6 on jdk1.6.0_14.

The problem is such,

if I compile the classes in WEB-INF/classes using eclipse Galileo everything runs fine.
But if I compile those same classes using ANT, jsp comilation in tomcat fails with the following stack trace:

org.eclipse.jdt.internal.compiler.classfmt.ClassFormatExcept ion
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init >(ClassFileReader.java:342)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompile r.java:206)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompile r.java:178)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.a skForType(LookupEnvironment.java:122)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getT ypeOrPackage(PackageBinding.java:178)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Sc ope.java:2101)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference .getTypeBinding(QualifiedTypeReference.java:69)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveT ype(TypeReference.java:134)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.r esolveTypeFor(SourceTypeBinding.java:1273)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.f ields(SourceTypeBinding.java:604)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.f aultInTypesForFieldsAndMethods(SourceTypeBinding.java:582)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScop e.faultInTypes(CompilationUnitScope.java:431)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler. java:616)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler. java:392)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTComp iler.java:429)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:33 4)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:31 2)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:29 9)
at org.apache.jasper.JspCompilationContext.compile(JspCompilati onContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java :260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:489)
at java.lang.Thread.run(Thread.java:619)

This happens as well under tomcat 5.5.
Changing the ANT build to use the same JDT compiler as eclipse did not change the problem.
Using javap I checked both compiled versions of the classes and they do have the same major version.

I am using ant 1.7.1 and org.eclipse.jdt.core_3.5.1.v_972_R35x.jar

Any hint towards what might be the problem here is greatly appreciated.

Thanks a lot,

fabian
Re: jsp compilation fails with ClassFormatException [message #513028 is a reply to message #512922] Mon, 08 February 2010 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Le 2010-02-08 06:25, Fabian a écrit :
> org.eclipse.jdt.internal.compiler.classfmt.ClassFormatExcept ion
> at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init
> >(ClassFileReader.java:342)
> at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompile r.java:206)
> at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompile r.java:178)
If you can tell me how you got this problem (what do I need to do to
reproduce the same issue), then I'd like to debug it.
Please open a bug report against JDT/Core with steps to reproduce, build
id and any information that could help us to work on it.
No need to say that the better the steps are, the faster the bug is fixed.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT

Thanks,
--
Olivier
Re: jsp compilation fails with ClassFormatException [message #513069 is a reply to message #512922] Mon, 08 February 2010 12:26 Go to previous messageGo to next message
Eclipse UserFriend
I prefer to make sure that the Eclipse build and the Ant build are kept separate. I never have them both write build output to the same directory. It avoids troubles like these. Have your Ant build compile classes to a build directory, and then have a "war" task assemble the war from those built classes. I always set the output folder in Eclipse to "bin", but I never use that directory from Ant.
Re: jsp compilation fails with ClassFormatException [message #513071 is a reply to message #513069] Mon, 08 February 2010 12:53 Go to previous messageGo to next message
Eclipse UserFriend
The builds are separate.
I build with ant (standalone, no eclipse involved), assemble, deploy >> the error occurs
then i copy the the classes fom the eclipse output into WEB-INF/classes and the error is gone.
Ant is using the same java installation, the same jdt compiler jar and the same source and target levels as eclipse.
Re: jsp compilation fails with ClassFormatException [message #513077 is a reply to message #513071] Mon, 08 February 2010 13:14 Go to previous messageGo to next message
Eclipse UserFriend
And you're certain that all the Ant output directories are different from the Eclipse output directories?

Are you doing an "ant clean" at the start of the Ant build?

Frankly, I wouldn't use an Eclipse compiler for the Ant build. The build shouldn't have a dependency on Eclipse.
Re: jsp compilation fails with ClassFormatException [message #513080 is a reply to message #513077] Mon, 08 February 2010 13:33 Go to previous messageGo to next message
Eclipse UserFriend
The output directories are definitely different.
I just implemented jdt compilation because it worked compiled from eclipse but not from javac task using plain javac.
Only that did not make a difference. Even when i use the jdt compiler it doesnt work when build in ant.
Maybe it is an ant 1.7.1 problem or a conflict with some classes in my ant classpath or eclipse has something in its classpath that makes everything allright - ??
I have not tried yet building it with a previous ant version.
Just hoped someone might just say, yup has happened before, when xyz..
Re: jsp compilation fails with ClassFormatException [message #513087 is a reply to message #512922] Mon, 08 February 2010 14:16 Go to previous messageGo to next message
Eclipse UserFriend
At this point, I would convert back to the non-eclipse compiler for the Ant build, then add "verbose" to the javac call. It seems like it might be an issue with one of the jars that you're using. Adding "verbose" should point you closer to what jar or class it is complaining about.
Re: jsp compilation fails with ClassFormatException [message #513261 is a reply to message #513087] Tue, 09 February 2010 09:52 Go to previous message
Eclipse UserFriend
thanks for the tip! I will try that.
Previous Topic:unable to see jboss 5.1 in list
Next Topic:Where is maven-exec-plugin for download
Goto Forum:
  


Current Time: Mon Mar 17 08:37:21 EDT 2025

Powered by FUDForum. Page generated in 0.02988 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top