5 Replies Latest reply on Dec 1, 2011 4:51 AM by Srinivasa Rao Ammina

    Login page is being called continuosly.

    Srinivasa Rao Ammina Newbie

      Hi,

       

      We are running the web application using jboss-4.0.3 application server and we used the Filter to route the requests through

      it. Application is running well but if we see the logs we found the continuously printing the logs which were placed in the Filter.

      And from the logs we came to know that it is printing the requested page path (using req.getServletPath()) as login page.

      No one is using the application, but still it is printing the logs with the login page name as requested file. This is happening in the production environment and the environment of the production is:

       

      Linux tolppma01 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

       

      But same is not happening in the local or other environments.

       

      Could you please guide us the issue.

       

      Thanks

      Srinivasa Rao Ammina

        • 1. Re: Login page is being called continuosly.
          Jean-Frederic Clere Master

          "the Filter" which Filter? Notes that the Filters are called depending on the mapping, check the mapping.

          • 2. Re: Login page is being called continuosly.
            Srinivasa Rao Ammina Newbie

            We have written a LoginFilter and the code of the doFilter method looks in the following manner.

             

            LoginFilter.java

             

            public class LoginFilter implements Filter {

            public void doFilter(ServletRequest request, ServletResponse response,

                        FilterChain chain) throws java.io.IOException, ServletException {

                    HttpServletRequest req = (HttpServletRequest) request;

                    HttpServletResponse res = (HttpServletResponse) response;

                    HttpSession session = req.getSession();

                    String path = req.getServletPath();

                    String contextPath = req.getContextPath();

                    UserDetailsDAO userProfileDAO = (UserDetailsDAO) session.getAttribute("validUser");

                    System.out.println("Start : Filter - Path - " + path);

             

                     if (userProfileDAO == null) {

                        System.out.println("Session is New - " + session.isNew());           

                        if(path.equalsIgnoreCase("/doLoginAction.do") || path.equalsIgnoreCase("//webapp/pages/Login.jsp")){           

                            System.out.println("New Session");

                            chain.doFilter(request, response);

                        }

                    }

                    else if (userProfileDAO != null) {

                            System.out.println("Filter - Valid Session");

                            chain.doFilter(request, response);

                    }

                    System.out.println("End : Filter - ");

            }

            }

             

            -------------------------------------------------

             

            Configurations in web.xml

             

             

                <filter>   

                        <filter-name>LoginFilter</filter-name>

                        <filter-class>com.tcs.telecom.ppm.filter.LoginFilter</filter-class>

                </filter>

             

                <filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>*.do</url-pattern>

                </filter-mapping>

               

                <filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>*.jsp</url-pattern>

                </filter-mapping>

               

                <filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>*.to</url-pattern>

                </filter-mapping>

             

             

                <servlet>

                        <servlet-name>session</servlet-name>

                       <jsp-file>/webapp/pages/Login.jsp</jsp-file>

                </servlet>

              

                   <servlet-mapping>

                        <servlet-name>action</servlet-name>

                        <url-pattern>*.do</url-pattern>

                </servlet-mapping>

                 

                    <servlet-mapping>

                        <servlet-name>action</servlet-name>

                        <url-pattern>*.to</url-pattern>

                </servlet-mapping>

               

                <servlet-mapping>

                        <servlet-name>session</servlet-name>

                        <url-pattern>*.so</url-pattern>

                </servlet-mapping>

             

             

                    <welcome-file-list><welcome-file>

                        /webapp/pages/Login.jsp

                    </welcome-file></welcome-file-list>

             

             

            ----------------------------------------------------------------------------

             

            Here the issue is we are continuosly seeing the below logs in the server these logs those are coming from the LoginFilter.java even though no users are accessing the application.

             

            [STDOUT] Start : Filter - Path - //webapp/pages/Login.jsp

            [STDOUT] Session is New - true

            [STDOUT] New Session

             

            Could you please help us in identifying the issue?

            • 3. Re: Login page is being called continuosly.
              Srinivasa Rao Ammina Newbie

              Hi apart from the above information we are suspecting that some process might be running in unix system which might be pinging the web application URL for every 2 seconds in the production environment so on accessing the URL it would redirect to the login page and it is displaying the logs in the LoginFilter which is configured for login page.

               

              Here from the above code snippet in the LoginFilter.java we are having the below code.

               

              HttpSession session = req.getSession();

              System.out.println("Session is New - " + session.isNew()); 

               

              And it is displaying the session as new. So will there be any performance impact on the web application? since for every

              2 seconds login page is being hitted and every time a new session is being created from the process (not from the web URL) and this session is not being used any more.

               

              Could you please let us know about this ?

              • 4. Re: Login page is being called continuosly.
                Jean-Frederic Clere Master

                "So will there be any performance impact on the web application?"

                hm can't answer that question: it is your application

                 

                if you run 250 req/s, one more request every 2 seconds should not be a problem...If you run 1 req/s may be

                • 5. Re: Login page is being called continuosly.
                  Srinivasa Rao Ammina Newbie

                  Thanks for the update. We won't be getting that much number of requests but concern here is for every 2 seconds HttpSession session = req.getSession(); statement being called and if we check session.isNew() it is returning 'TRUE' for all the requests if we check in the logs. So by this information can we tell that many number of new session are being created un necessarily?