2
votes

I am working with struts-hibernate project and deployed successfully in multiple web application servers like, Tomcat, JBoss, WAS etc.

Here is something strange issue I am getting when deployed same application in WebLogic 10.3.6 server.

I have few filters in web.xml for processing the request before action classes. These filters are initialized when application loads (debug goes in init method), when I hit URLs it should go first to doFilter methods of My Filter Classes, but in case of weblogic it is not working.

Same thing works in other web application servers.

Web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE web-app PUBLIC
          "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">

    <web-app>

  <!-- Parameter for JSTL resource bundle usage. -->
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>app_resources</param-value>
  </context-param>

  <!-- Parameters related to application configuration. -->
  <context-param>
    <param-name>configFile</param-name>
    <param-value>/WEB-INF/app-config.xml</param-value>
  </context-param>
  <context-param>
    <param-name>configClass</param-name>
    <param-value>org.apache.struts.apps.ajaxchat.AjaxChatConfig</param-value>
  </context-param>


    <filter>
        <filter-name>
            Logging Filter
        </filter-name>
        <description>
            Filter used to log each user action
        </description>
        <filter-class>
            com.mypackage.ActivityLoggingFilter
        </filter-class>
    </filter>

    <!-- Use this if you want db authentication -->
    <filter>
        <filter-name>
            AuthFilter
        </filter-name>
        <description>
            Filter handling custom user authentication
        </description>
        <filter-class>
            com.mypackage.AuthenticationFilter
        </filter-class>
        <init-param>
            <param-name>auth_uri</param-name>
            <param-value>/Login.do</param-value>
        </init-param>
        <init-param>
            <param-name>password_change_uri</param-name>
            <param-value>/PasChangeExp.do</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>AuthFilter</filter-name>
        <servlet-name>action</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>AuthFilter</filter-name>
        <servlet-name>tcode</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>AuthFilter</filter-name>
        <servlet-name>help</servlet-name>
    </filter-mapping>

    <!-- Map the filter to a Servlet or URL -->

    <filter-mapping>
        <filter-name>Logging Filter</filter-name>
        <servlet-name>action</servlet-name>
    </filter-mapping>

    <!-- Listeners -->
    <!--
    <listener>
        <listener-class>com.mypackage.HibernateListener</listener-class>
    </listener>
    -->
    <listener>
        <listener-class>
            com.mypackage.SessionListener
        </listener-class>
    </listener>
    <listener>
      <listener-class>com.mypackage.ContextListener</listener-class>
    </listener>

  <listener>
    <listener-class>javawebparts.listener.AppConfigContextListener</listener-class>
  </listener>

    <servlet>
        <servlet-name>Log4JInitServlet</servlet-name>
        <servlet-class>com.mypackage.Log4JInitServlet</servlet-class>
        <init-param>
            <param-name>log4j-properties-location</param-name>
            <param-value>/WEB-INF/classes/logging.properties</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>


    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>com.mypackage.InheritanceActionServet</servlet-class>

        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/modules/main/config/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>config/main/user</param-name>
            <param-value>/WEB-INF/modules/main/modules/user/config/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>config/main/group</param-name>
            <param-value>/WEB-INF/modules/main/modules/group/config/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>config/main/profile</param-name>
            <param-value>/WEB-INF/modules/main/modules/profile/config/struts-config.xml</param-value>
        </init-param>

        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>MenuInitServlet</servlet-name>
        <servlet-class>com.mypackage.MenuInitServlet</servlet-class>
         <load-on-startup>4</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>JnlpDownloadServlet</servlet-name>
        <servlet-class>com.sun.javaws.servlet.JnlpDownloadServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>tcode</servlet-name>
        <servlet-class>com.mypackage.TcodeServiceImpl</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>help</servlet-name>
        <servlet-class>com.mypackage.HelpServlet</servlet-class>
    </servlet>

    <!-- servlet-mapping>
        <servlet-name>JnlpDownloadServlet</servlet-name>
        <url-pattern>*.jnlp</url-pattern>
    </servlet-mapping -->

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>tcode</servlet-name>
        <url-pattern>/tcode/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>help</servlet-name>
        <url-pattern>/static/help/*</url-pattern>
    </servlet-mapping>

    <session-config>
            <session-timeout>15</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
      <error-code>400</error-code>
      <location>/ErrorPage.do</location>
    </error-page>

    <error-page>
      <error-code>404</error-code>
      <location>/ErrorPage404.do</location>
    </error-page>

    <error-page>
      <error-code>500</error-code>
      <location>/ErrorPage500.do</location>
    </error-page>

    <taglib>
        <taglib-uri>/tags/struts-bean</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/struts-html</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/struts-logic</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/struts-tiles</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/struts-nested</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-nested.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/menu</taglib-uri>
        <taglib-location>/WEB-INF/tlds/menu.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/navigator</taglib-uri>
        <taglib-location>/WEB-INF/tlds/navigator.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/list</taglib-uri>
        <taglib-location>/WEB-INF/tlds/list.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/table</taglib-uri>
        <taglib-location>/WEB-INF/tlds/table.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/monitor</taglib-uri>
        <taglib-location>/WEB-INF/tlds/client.tld</taglib-location>
    </taglib>
       <taglib>
        <taglib-uri>/tags/alerts</taglib-uri>
        <taglib-location>/WEB-INF/tlds/alerts.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/custom</taglib-uri>
        <taglib-location>/WEB-INF/tlds/customFields.tld</taglib-location>
    </taglib>
    <taglib>
     <taglib-uri>/tags/filter</taglib-uri>
        <taglib-location>/WEB-INF/tlds/filter.tld</taglib-location>
    </taglib>
    <taglib>
     <taglib-uri>/tags/selectChoices</taglib-uri>
        <taglib-location>/WEB-INF/tlds/selectChoices.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/matrix</taglib-uri>
        <taglib-location>/WEB-INF/tlds/matrix.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/report</taglib-uri>
        <taglib-location>/WEB-INF/tlds/report.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/tags/listWithActionTag</taglib-uri>
        <taglib-location>/WEB-INF/tlds/listWithActionTag.tld</taglib-location>
    </taglib>

    <!-- resource -->
    <!--resource-ref>
        <res-ref-name>jdbc/prototype</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref-->

</web-app>

weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" 
    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-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
    <context-root>mps</context-root>
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
        <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
    </container-descriptor>
</weblogic-web-app>
1
Have you considered adding <url-pattern>/*</url-pattern> or <dispatcher>REQUEST</dispatcher> to your filter mapping? It seems like the mapping is not workingDisplay Name is missing
Yes I tried this too, but no hope.Shreyas Dave

1 Answers

0
votes

I found that while extending Filter class, it was required to add @Override annotation above filter class method. Adding this resolved my issue.