4 Replies Latest reply on Oct 1, 2010 4:58 AM by csenes csenes

    infinitive redirect loop

    csenes csenes Newbie

      the program run normally if I write servername/myloginpage.xhtml on browser adress bar, but doesnt work and get error infinitive redirect loop if I write servername/ and no stacktrace ,Previously it worked but now doesnt work,How can I solve this,Anyone meet this thing before ,thanks for reply

        • 1. Re: infinitive redirect loop
          csenes csenes Newbie

          I guess I found error , the filter I created cause it,but this filter is necessary for me,How can I fix it without delete this filter

          package org.domain.kaliteyonsist.filter;
          import java.io.IOException;
          import javax.servlet.Filter;
          import javax.servlet.FilterChain;
          import javax.servlet.FilterConfig;
          import javax.servlet.ServletException;
          import javax.servlet.ServletRequest;
          import javax.servlet.ServletResponse;
          import org.hibernate.SessionFactory;
          import org.jboss.seam.ScopeType;
          import org.jboss.seam.annotations.In;
          import org.jboss.seam.annotations.Scope;
          import org.jboss.seam.log.Log;
          import org.jboss.seam.persistence.HibernateSessionFactory;
          public class HibernateSessionRequestFilter implements Filter{
               private HibernateSessionFactory hib = new HibernateSessionFactory();
               private SessionFactory sf;
               private static Log log;
               public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) 
               throws IOException,ServletException{
                    try {
                    } catch (Throwable ex) {
                         // TODO: handle exception
                         try {
                         } catch (Exception e) {
                              // TODO: handle exception
                              log.error("Geri alim başarisiz"+e.getLocalizedMessage());
                    throw new ServletException(ex);
               public void init(FilterConfig filterConfig) throws ServletException {
                    try {
                          sf = hib.getSessionFactory();
                    } catch (Exception e) {
                         // TODO: handle exception
                         log.error("hata burda cıkıyor" + e.getMessage());
               public void destroy() {
                    // TODO Auto-generated method stub

          • 2. Re: infinitive redirect loop
            Aldo Bonzi Novice

            Are injections actually working inside that JSF filter?

            If you find that to be the origin of errors you could try to use a seam servlet filter instead of a JSF one(extending from AbstractFilter rather than implementing Filter).

            • 3. Re: infinitive redirect loop
              Neil Richardson Newbie

              I agree with Aldo here - I can't see how the injections will actually work here without using the Seam @Filter annotation to install the filter (rather than defining it in web.xml as you appear to have done here). Also be careful with injectors in application-scoped components - application-scoped components aren't synchronized by Seam (it would be too expensive) so there is potential for concurrency issues.

              On another issue, why do you require this filter? Surely it would be better to use Seam's built-in transaction control? You'd have much finer control over transaction demarcation than using a filter and is one Seam's major selling points.

              • 4. Re: infinitive redirect loop
                csenes csenes Newbie

                thanks your reply , I use this filter to prevent LazyİnitializationException,