3 Replies Latest reply on Apr 29, 2016 5:29 PM by Burghard Britzke

    JSF2.2 + weld2.3.4 + tomcat8

    Burghard Britzke Newbie

      I tried to setup my web app with no success.

      I placed the two dependencies into the pom.xml

      <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.2.13</version>
      </dependency>
      

      for JSF2.2 Mojarra

      <dependency>
        <groupId>org.jboss.weld.servlet</groupId>
        <artifactId>weld-servlet-core</artifactId>
        <version>2.3.4.Final</version>
      </dependency
      

      and for weld.

      But during Deployment via eclipse I get the following exception

      Apr 28, 2016 11:13:12 PM com.sun.faces.config.ConfigureListener contextInitialized
      SCHWERWIEGEND: Critical error during deployment:
      com.sun.faces.config.ConfigurationException: 
        Source Document: jar:file:/Users/bubi/Documents/Java/workspace-airbub/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/crm/WEB-INF/lib/weld-servlet-core-2.3.4.Final.jar!/META-INF/faces-config.xml
        Cause: Unable to create a new instance of 'org.jboss.weld.jsf.ConversationAwareViewHandler': javax.faces.FacesException: org.jboss.weld.jsf.ConversationAwareViewHandler
        at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:378)
        at com.sun.faces.config.processor.ApplicationConfigProcessor.setViewHandler(ApplicationConfigProcessor.java:621)
        at com.sun.faces.config.processor.ApplicationConfigProcessor.processViewHandlers(ApplicationConfigProcessor.java:961)
        at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:356)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:137)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:239)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4809)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5251)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.faces.FacesException: org.jboss.weld.jsf.ConversationAwareViewHandler
        at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:428)
        at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:301)
        ... 18 more
      Caused by: java.lang.ClassNotFoundException: org.jboss.weld.jsf.ConversationAwareViewHandler
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
      
      

      I looked for the class but it is not in the maven dependencies.The same error occurs when deploying with myfaces 2.2. I read the docs for http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#weld-servlet.I found another dependency which brings the class. I added it to my pom.xml

      <dependency>
        <groupId>org.jboss.weld</groupId>
        <artifactId>weld-core-jsf</artifactId>
        <version>2.3.4.Final</version>
      </dependency>
      
      

      and the deployment exception has gone. But when the first bean should be produced another exception raises:

      Apr 28, 2016 11:46:14 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
      SCHWERWIEGEND: Error Rendering View[/index.xhtml]
      java.lang.IllegalStateException: Singleton not set for STATIC_INSTANCE => []
        at org.jboss.weld.bootstrap.api.helpers.RegistrySingletonProvider$RegistrySingleton.get(RegistrySingletonProvider.java:28)
        at org.jboss.weld.Container.instance(Container.java:65)
        at org.jboss.weld.jsf.ConversationAwareViewHandler.getConversationContext(ConversationAwareViewHandler.java:81)
        at org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:110)
        at com.sun.faces.renderkit.html_basic.FormRenderer.getActionStr(FormRenderer.java:250)
        at com.sun.faces.renderkit.html_basic.FormRenderer.encodeBegin(FormRenderer.java:143)
        at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:865)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
      ...
      
      

      Did I miss something in my configuration?

       

      Nachricht geändert durch Burghard Britzke added the maven dependencies for mojarra and weld (had not been visible)