8 Replies Latest reply on Dec 12, 2011 2:07 AM by assen

    Need help with s:viewAction

    assen-todorov

      Hi,


      I cannot get s:viewAction work. I try to use it exactly as specified in the seam 3 documentation, but without success.


      This is my page


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:s="http://jboss.org/seam/faces"
                      xmlns:dms="http://www.ligatus.com/jsf/tags"
                      template="../../resources/templates/default.xhtml">
         <ui:define name="metadata">
            <f:metadata>
               <f:viewParam name="id" value="#{selectedId}"/>
               <s:viewAction action="#{engine.selectedItem(selectedId)}"/>
            </f:metadata>
         </ui:define>
      ...
      



      and this is my template


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:f="http://java.sun.com/jsf/core">
      <f:view>
         <ui:insert name="metadata"/>
      <h:head>
         <title>DA Engine</title>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
         <link rel="stylesheet" href="/resources/css/default.css" type="text/css" media="screen"/>
      </h:head>
      <h:body>
      
      ...
      
      </h:body>
      </f:view>
      </html>
      



      After successful deploy I get this exception if I click on the link that goes to this page



      09:23:10,682 SCHWERWIEGEND [javax.enterprise.resource.webcontainer.jsf.application] JSF1068: Komponente mit Komponententyp org.jboss.seam.faces.ViewAction kann nicht instanziiert werden.
      09:23:10,697 FATAL [org.jboss.seam.faces.view.SeamViewMetadata] Ausdrucksfehler: Benanntes Objekt org.jboss.seam.faces.ViewAction nicht gefunden.
      09:23:10,697 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/engine].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalArgumentException: null source
           at java.util.EventObject.<init>(EventObject.java:38) [:1.6.0_12]
           at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67) [:2.0.3-]
           at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69) [:2.0.3-]
           at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69) [:2.0.3-]
           at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256) [:2.0.3-]
           at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245) [:2.0.3-]
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107) [:2.0.3-]
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) [:2.0.3-]
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308) [:2.0.3-]
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
           at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [:6.0.0.Final]
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
           at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
           at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
           at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
           at java.lang.Thread.run(Thread.java:619) [:1.6.0_12]
      
      09:23:10,713 ERROR [org.jboss.web.tomcat.service.jca.CachedConnectionValve] Application error: Faces Servlet did not complete its transaction
      



      The exception basically says that org.jboss.seam.faces.ViewAction could not be found.
      I deploy an ear-file and seam-faces 3.0.0.Final is definitely in the lib directory in the ear-file along with other seam 3 artefacts.


      Can someone help mi with this issue?


        • 1. Re: Need help with s:viewAction
          ssachtleben.ssachtleben.gmail.com

          You dont need to insert your f:metadata stuff into the template. You can directly use f:metadata inside of the ui:composition of the page.

          • 2. Re: Need help with s:viewAction
            assen-todorov

            Hi,


            Thanks for your reply.I tried this but the same exception is thrown.

            • 3. Re: Need help with s:viewAction
              ssachtleben.ssachtleben.gmail.com

              Ok strange seems like your project is not set up properly. I use viewAction in nearly every page without any problems.
              Check your startup logfile. Is seam faces initialized properly?


              Not sure if it causes the problem but I populate directly the fields in viewParam like this:


                    <f:metadata>
                       <f:viewParam name="id" value="#{engine.selectedId}"/>
                       <s:viewAction action="#{engine.doSomething}"/>
                    </f:metadata>



              • 4. Re: Need help with s:viewAction
                assen-todorov

                Hi Sebastian,


                I tried to populate the field as you suggested, but without success. There are not errors or warnings during the deployment. In the log file before the exception I see this


                2011-06-16 11:54:16,678 WARN  [org.jboss.seam.faces.environment.SeamApplicationWrapper] (http-127.0.0.1-8080-3) Cannot attempt extension on null
                



                but according to google it is not directly related with seam faces.

                • 5. Re: Need help with s:viewAction
                  ssachtleben.ssachtleben.gmail.com

                  I have that warning also in log files. Which faces version do u use?

                  • 6. Re: Need help with s:viewAction
                    assen-todorov

                    Hi Sebastian,


                    I use JSF 2.0

                    • 7. Re: Need help with s:viewAction
                      bwilly

                      I am having the very same problem. Were you able to solve this? Thanks.


                      I am using Seam Faces 3.1.0.Beta5

                      • 8. Re: Need help with s:viewAction
                        assen

                        Hi Brian,


                        If you deploy your application as an EAR file in JBoss 6.x, then most likely you are facing this unresolved bug in Weld : WELD-778


                        If so, then s:viewAction and s:validateForm do not work.


                        You can try to add the following lines in your faces-config.xml :


                           <component>
                              <component-type>org.jboss.seam.faces.InputContainer</component-type>
                              <!--suppress FacesModelInspection -->
                              <component-class>org.jboss.seam.faces.component.UIInputContainer</component-class>
                           </component>
                        
                           <component>
                              <component-type>org.jboss.seam.faces.ValidateForm</component-type>
                              <!--suppress FacesModelInspection -->
                              <component-class>org.jboss.seam.faces.component.UIValidateForm</component-class>
                           </component>
                        
                           <component>
                              <component-type>org.jboss.seam.faces.ViewAction</component-type>
                              <!--suppress FacesModelInspection -->
                              <component-class>org.jboss.seam.faces.component.UIViewAction</component-class>
                           </component>
                        



                        This workaround works perfect for me and I am able to use s:viewAction and s:validateForm in EAR file on JBoss 6.x.


                        I recommend this site for Seam 3/Weld/EAR-Deployment issues : Seam 3 - Wiki