11 Replies Latest reply on Mar 14, 2008 9:22 PM by cleverswine

    inifinite redirects

    cleverswine

      Hi,


      I've got a very basic Seam, Facelets, and EJB 3.0 application written based on the jee5/booking example. When I visit http://localhost/myContextRoot, I'm sent an infinite stream of HTTP 302 redirects to the debug.seam page. The debug page never appears, nor does anything else. I don't even know why the debug page is trying to display. What could I be doing wrong?


      Thanks in advance for any help.


      GET /expressionbuilder/home.seam HTTP/1.1
      Host: rb85d5.bbh.com:9084
      User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
      Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip,deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive: 300
      Connection: keep-alive
      Cookie: JSESSIONID=0000JuI4tmtbnF6SWkcsGNN9CGs:-1
      
      HTTP/1.1 302 Found
      Location: http://rb85d5.bbh.com:9084/expressionbuilder/debug.seam?conversationId=16
      Content-Language: en-US
      Transfer-Encoding: chunked
      Date: Wed, 12 Mar 2008 19:53:56 GMT
      Server: WebSphere Application Server/6.1
      
      0
      
      GET /expressionbuilder/debug.seam?conversationId=16 HTTP/1.1
      Host: rb85d5.bbh.com:9084
      User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
      Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip,deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive: 300
      Connection: keep-alive
      Cookie: JSESSIONID=0000JuI4tmtbnF6SWkcsGNN9CGs:-1
      
      HTTP/1.1 302 Found
      Ajax-Expired: View state could't be restored - reload page ?
      Location: http://rb85d5.bbh.com:9084/expressionbuilder/debug.seam?conversationId=16
      Content-Language: en-US
      Transfer-Encoding: chunked
      Date: Wed, 12 Mar 2008 19:53:56 GMT
      Server: WebSphere Application Server/6.1
      
      0
      
      ...etc...
      


        • 1. Re: inifinite redirects
          goldmann.marek.goldmann.pl

          Probably you are executing an action on /home.xhtml view-id and that action redirects to view-id /home.xhtml. If this is true - change your implementation of this method to return nothing (e.g. public void execute()), if not - please post more info.

          • 2. Re: inifinite redirects
            cleverswine

            Hi Goldmann,


            Thanks for the reply. No actions are executed because nothing renders to the screen for me to click/submit. The redirect to debug.seam is infinite.


            Here is web.xml:


            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4"
                     xmlns="http://java.sun.com/xml/ns/j2ee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                                         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
            
              <!-- Seam -->
            
              <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
              </listener>
            
              <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
              </filter>
            
              <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
              </filter-mapping>
            
              <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
              </servlet>
            
              <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
              </servlet-mapping>
            
              <!-- JSF and Facelets -->
            
              <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
              </context-param>
            
              <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>true</param-value>
              </context-param>
            
              <!-- <context-param>
                 <param-name>com.sun.faces.expressionFactory</param-name>
                 <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
              </context-param> -->
            
              <context-param>
                 <param-name>com.sun.faces.displayConfiguration</param-name>
                 <param-value>true</param-value>
              </context-param>      
            
            <context-param>
                <param-name>org.jboss.seam.core.init.debug</param-name>
                <param-value>true</param-value>
            </context-param>
            
              <!-- Faces Servlet -->
            
              <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
              </servlet>
            
              <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.seam</url-pattern>
              </servlet-mapping>
            
              <ejb-local-ref>
                <ejb-ref-name>lolcats/MyAction</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                 <local-home></local-home>
                <local>com.lolcats.MyAction</local>
              </ejb-local-ref>
            
              <welcome-file-list>
                <welcome-file>index.html</welcome-file>
              </welcome-file-list>
            
            </web-app>



            Here is pages.xml:



            <?xml version="1.0" encoding="UTF-8"?>
            <pages xmlns="http://jboss.com/products/seam/pages"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
            
                   no-conversation-view-id="/home.xhtml">
            
                <page view-id="/search.xhtml">
                </page>
            
                <page view-id="/home.xhtml">
                </page>
            </pages>




            Here is faces-config.xml:


            <?xml version="1.0" encoding="UTF-8"?>
            <faces-config version="1.2"
               xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
            
                <!-- Facelets support -->
                <application>        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
                </application>
            
            </faces-config>



            Here is components.xml:



            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
                        xmlns:core="http://jboss.com/products/seam/core"
                        xmlns:security="http://jboss.com/products/seam/security"
                        xmlns:transaction="http://jboss.com/products/seam/transaction"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation=
                            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                             
                 <core:init jndi-pattern="java:comp/env/expression-builder/#{ejbName}" debug="true"/> 
                 <transaction:ejb-transaction/>                    
            </components> 



            Here is index.html:


            <html>
            <head>
              <meta http-equiv="Refresh" content="0; URL=home.seam">
            </head>
            </html>



            Here is home.xhtml:


            <!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.com/products/seam/taglib"
                            xmlns:a="http://richfaces.org/a4j"
                                template="template.xhtml">
            
            <ui:define name="content">
                <span class="errors">
                   <h:messages globalOnly="true"/>
                </span>
                <h1>Member Search</h1>
                
              <h:form id="main"> 
              </h:form>
              
            </ui:define>
            </ui:composition>  



            and, finally, here is template.xhtml:



            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:h="http://java.sun.com/jsf/html"
                  xmlns:s="http://jboss.com/products/seam/taglib">
            <head>
                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                 <title></title>
                 <link href="styles/screen.css" rel="stylesheet" type="text/css" />
            </head>
            <body>
            
            <div id="document">
            
            <div id="content">
                 <ui:insert name="content"/>
            </div>
            
            </div>
            </body>
            </html>



            Many thanks,
            Bill

            • 3. Re: inifinite redirects
              goldmann.marek.goldmann.pl

              I don't know if I could help you more - I haven't run Seam on WebSphere...

              • 4. Re: inifinite redirects
                cleverswine

                Thanks, but this isn't related to Websphere because I have the Hotel Booking jee5 example application running just fine on the exact same Websphere server. It is something wrong with my configuration, I imagine.


                Anyone else have any ideas?

                • 5. Re: inifinite redirects
                  keithnaas

                  Bill,


                  Have you tried simplifying the application even further.


                  For instance, don't have home.xhtml extend template.xhtml to eliminate one piece of the puzzle.  And keep the content ultra simple like a Hello World :)


                  Also, eliminate the ejbs from the application and see what that does.


                  At this point if its still occurring, remove the context-param for Facelets.DEVELOPMENT.  When this is turned on and page rendering blows up, it will write a bunch of stuff to the screen.  This can be helpful at times, but based on my experience it can sometimes interfere with finding the root cause of a problem.


                  At this point, is there anything else you can remove from the mix?


                  Keith

                  • 6. Re: inifinite redirects
                    cleverswine

                    Hi Keith,


                    Many thanks for the tips. I'll try your three suggestions. In the meantime, I made a few modifications to get the EAR to deploy on jboss 4.2.2 since jboss has better error logging :)


                    The ear deploys with no errors on jboss, but all requests to the application result in the same infinite redirect... just like on Websphere. However, I do get a stack trace this time. Yay!


                    So as to not clutter this post with too much noise, I've posted a trimmed version of the log with stacktrace here:


                    http://pastebin.mozilla.org/365789


                    The root cause of the problem appears to be javax.naming.NameNotFoundException expressionbuilder not bound
                    ...which points to a configuration error, no?


                    I'll try your suggestions and reply back.

                    • 7. Re: inifinite redirects
                      srini.ragu

                      <core:init jndi-pattern="java:comp/env/expression-builder/#{ejbName}" debug="true"/>


                      seems like you jndi pattern is not correct, could you check that it was right?

                      • 8. Re: inifinite redirects
                        cleverswine

                        Hi Srinivasan,


                        Yes, that the jndi pattern was wrong. However, when I fix the jndi pattern to what you suggest, the seam EJB in jboss-seam.jar cannot be found:


                        Name "comp/env/expressionbuilder/EjbSynchronizations" not found in context "java:".



                        jboss-seam.jar is in the root of my EAR, and application.xml defines it as an ejb jar:


                        <module>
                             <ejb>jboss-seam.jar</ejb> 
                        </module> 



                        Any ideas?

                        • 9. Re: inifinite redirects
                          cleverswine

                          p.s. if i remove transaction:ejb-transaction
                          from components.xml, everything works just fine. But I don't want to remove this.

                          • 10. Re: inifinite redirects
                            srini.ragu

                            Seems like you missed a step in configuration:


                            http://docs.jboss.com/seam/2.0.1.GA/reference/en/html/websphere.html


                            resources/WEB-INF/web.xml


                              <ejb-local-ref>
                                <ejb-ref-name>websphere_example/EjbSynchronizations</ejb-ref-name>  
                                <ejb-ref-type>Session</ejb-ref-type>
                                <local-home></local-home>
                                <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
                              </ejb-local-ref>




                            this is need for servlet 2.4 containers..

                            • 11. Re: inifinite redirects
                              cleverswine

                              Indeed, I did miss that step. Thank you, Srinivasan!!