11 Replies Latest reply on Oct 19, 2006 7:36 PM by Gavin King

    contactlist example not working on jboss with JSF 1.2 RI

    Chuck Adams Novice

      I can't get the contactlist example working with the 1.2 RI -- when I try to edit or view a contact, I get a blank contact instead. I wonder whether some of my other hear-tearing experiences getting CRUD working by hand is related to the same problem.

      I opened up JBSEAM-427 in JIRA on this, but maybe someone else using the RI might have some thoughts on the matter. I'm fairly stumped. Right now my workaround is to not use JSF 1.2, which means having to mess up my object model to not use enums, unless I can find a decent enum converter for myFaces (which I guess would only involve mangling my views to add the converter).



        • 1. Re: contactlist example not working on jboss with JSF 1.2 RI
          Gavin King Master

          AFAIK it runs perfectly on the RI. Are you sure you have myFacesLifecycleBug=false?

          • 2. Re: contactlist example not working on jboss with JSF 1.2 RI
            Gavin King Master

            Ups, looks like I'm wrong .... oh and I bet I know why.

            There is a bug in the RI, that I already reported to Roger (and he is fixing it), that means Seam page actions and page parameters probably don't work reliably.

            I'll investigate a little bit more just to confirm that this is the real problem, but I'm almost certain it is.

            • 3. Re: contactlist example not working on jboss with JSF 1.2 RI
              Gavin King Master

              Yep, that is the problem. Try using view-ids like "/search.seam" instead of "/search.xhtml" in your pages.xml file. This should fix it.

              Note that this *is* a bug in the RI.

              • 4. Re: contactlist example not working on jboss with JSF 1.2 RI
                Chuck Adams Novice

                Positive. In fact I forgot to set it back to true when I tried it with myFaces, and it still worked.

                If the contactlist example works out of the box with the 1.2RI, then perhaps I'm configuring it wrong in jboss. Here's what I did to run it:

                • cvs checkout and build seam

                • delete myfaces* from /c/jboss/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs

                • copy jsf-api.jar and jsf-impl.jar from the RI to jsf-libs

                • copy el-api and el-ri.jar from seam/facelets/lib to jsf-libs

                • edit seam/build.properties to change the tomcat/jboss paths and change jbossHasMyFacesLifecycleBug to false

                • cd to examples/contactlist

                • edit resources/WEB-INF/web.xml to use the RI ConfigureListener instead of the myfaces one

                • edit resources/components.properties and verify that myFacesLifecycleBug is indeed false

                • edit build.xml to keep it from copying el-api and el-ri into the build's WEB-INF/lib (otherwise I get some nasty tracebacks about loader constraint violations)

                • ant deploy

                • navigate to http://localhost:8080/seam-contactlist/

                • click one of the contacts

                • see nothing but blank fields



                  Could the problem be related to having the EL stuff in jsf-libs and not the application? I've never made it work the other way around -- I can paste that traceback if you want.


                • 5. Re: contactlist example not working on jboss with JSF 1.2 RI
                  Chuck Adams Novice

                  Heh, all that typing and I could have waited a few more minutes instead. I'll try using the .seam view ids and see how that works.



                  • 6. Re: contactlist example not working on jboss with JSF 1.2 RI
                    Chuck Adams Novice

                    Okay, I switched all the .xhtml extensions in pages.xml to .seam, and now viewContact works, but editContact continues to give me a blank contact. Delete Contact is also nonfunctional, and results in this on the console:

                    WARNING: phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@5f8ddb) threw exception: javax.faces.el.EvaluationException: org.hibernate.TransientObjectException: the detached instance passed to delete() had a null identifier org.hibernate.TransientObjectException: the detached instance passed to delete() had a null identifier
                    com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:97)
                    org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
                    org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:71)
                    org.jboss.seam.core.Expressions$2.invoke(Expressions.java:93)
                    org.jboss.seam.core.Pages.callAction(Pages.java:309)
                    org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:171)
                    org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:143)
                    org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:52)
                    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:218)
                    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    ...etc...
                    


                    Just for the hell of it I changed all the view-id's in faces-config.xml to use .seam extensions too. No effect.


                    • 7. Re: contactlist example not working on jboss with JSF 1.2 RI
                      Chuck Adams Novice

                      PEBKAC again, I forgot to update the views themselves.

                      Still, the problems aren't over: when I edit a contact and click update, it switches immediately to the create screen and offers me "Create Contact" instead (which does actually work). Deleting a contact blanks all the fields, but doesn't delete the contact.

                      Back to myfaces once again.


                      • 8. Re: contactlist example not working on jboss with JSF 1.2 RI
                        Gavin King Master

                        Leave faces-config as it is. You probably need *both* .seam and .xhtml in pages.xml, I guess.

                        • 9. Re: contactlist example not working on jboss with JSF 1.2 RI
                          Gavin King Master

                          OK. So, I got the contactlist example running on JSF 1.2. There were 2 bugs in the JSF RI:

                          (1) the problem I have reported to Roger. I have committed a fix to Seam, to work around this bug.

                          (2) a problem where there is a wierdo EL bug when using the deprecated JSF 1.1 style VariableResolver (which Seam uses). I tried creating a JSF 1.2 ELResolver and got it working with that.

                          • 10. Re: contactlist example not working on jboss with JSF 1.2 RI
                            Gavin King Master

                            So, if you want to make Seam work in JSF 1.2, for now you need to add the following to faces-confg.xml:

                            <application>
                             <el-resolver>org.jboss.seam.jsf.SeamELResolver</el-resolver>
                            </application>


                            I'll see if i can find a better solution.


                            • 11. Re: contactlist example not working on jboss with JSF 1.2 RI
                              Gavin King Master

                              OK. Better solution found. MyFaces seems to tolerate the JSF 1.2 faces-config.xml, so I put it in the default Seam faces-config.

                              Now working ootb on 1.2.