NoClassDefFoundError: org/apache/tools/ant/BuildException

I am getting a java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException when trying to access a JSP in my application. It also happens if I only add vaadin-client-compiler-7.0.3.jar to my project (VAADIN taken out) as if something is automatically hokked up. I tried adding the ant libraries but that generated another error.
I am using JBOSS 4.2 the problem does not appear with JBoss 7.

14:52:42,935 ERROR [STDERR]
[ERROR]
[jsp]

  • Servlet.service() for servlet jsp threw exception <java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException>java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
    at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:197)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:508)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:662)

The vaadin-client-compiler jar is only necessary if you’re compiling the widgetset. If you’re compiling the widgetset, there are some other dependencies (in this case ant.jar) that must be satisfied.

If you’re not compiling the widgetset in your JSP page, then I’m guessing you’ve got some of the Vaadin jars in your project that you just shouldn’t have…

Some of the vaadin jars (i.e. the client compiler, themes compiler, etc.) contain some classes that you probably have duplicates of, and these duplicates affect the system’s JSP compiler. Thin out the vaadin jars and you should be fine.

That is right. Thank you!