5 Replies Latest reply: Jun 7, 2012 10:37 AM by Rafael Pestano RSS

    Configuring Tomcat 7 + JSF 2 + Weld

    Felipe Jaekel Newbie

      I'm trying to create a new project using tomcat 7.0.27 + JSF 2.1.7 + Weld 1.1.8


      After I add Weld to the project when I try to open a page I get the following exception:

       


      java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
                at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:345)
                at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
                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:225)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
                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:999)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
      
      

      And if I add JSTL 1.2 to the project JSF stops rendering (if I open the page source on browser its the same thing from the IDE).


      Any ideias?


      Thanks a lot,

      Phillip

        • 1. Re: Configuring Tomcat 7 + JSF 2 + Weld
          Ales Justin Master

          I don't see how this is a Weld issue -- no org.jboss.weld in stack trace.

          • 2. Re: Configuring Tomcat 7 + JSF 2 + Weld
            Felipe Jaekel Newbie

            If I remove Weld from the project pages render fine, even with JSTL on the classpath.

             

            It looks like that it is trying to render the page as JSP instead of Facelets.

             

            I pretend to use Seam Faces is this project too. Adding it and removing JSTL the stacktrace looks like this:

             

             

            GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/WeldTomcat] threw exception
            java.lang.RuntimeException: javax.enterprise.event.ObserverException
                at org.jboss.seam.faces.exception.CatchExceptionHandler.handle(CatchExceptionHandler.java:75)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
                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:999)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
            Caused by: javax.enterprise.event.ObserverException
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                at java.lang.Class.newInstance0(Class.java:355)
                at java.lang.Class.newInstance(Class.java:308)
                at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:344)
                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)
                at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:341)
                at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33)
                at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73)
                at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162)
                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245)
                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233)
                at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213)
                at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:590)
                at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:580)
                at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:575)
                at org.jboss.seam.faces.exception.CatchExceptionHandler.handle(CatchExceptionHandler.java:71)
                ... 25 more
            Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
                at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:345)
                at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
                at org.jboss.seam.faces.view.SeamViewDeclarationLanguage.buildView(SeamViewDeclarationLanguage.java:81)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                ... 24 more
            Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
                ... 29 more
            
            • 3. Re: Configuring Tomcat 7 + JSF 2 + Weld
              Bob Obringer Newbie

              I'm having the exact same issue...

               

              Weld 1.1.8, Jetty 8.1.4 and JSF 2.1.7

               

              If I manually include the jstl 1.2 dependency, the page loads but does not render the jsf.

               

              Weld is definitely stepping on jsf somewhere.

              • 4. Re: Configuring Tomcat 7 + JSF 2 + Weld
                Glauber Matos Newbie

                There are two implementations of the JSTL. Maybe you're using the implementation of the org.glassfish.web instead of javax.servlet.

                Try to replace your jstl jar with this:

                http://search.maven.org/remotecontent?filepath=javax/servlet/jstl/1.2/jstl-1.2.jar

                • 5. Re: Configuring Tomcat 7 + JSF 2 + Weld
                  Rafael Pestano Novice

                  Hi there, i got an example app running weld + jsf 2.1.7 in tomcat, these are libs im using:https://github.com/rpestano/jsf-issuetracker-project/tree/master/WebContent/WEB-INF/lib

                   

                   

                  maybe it helps.