2015-09-07 58 views
2

我用struts-Hibernate项目工作,并成功地部署在多个Web应用程序服务器一样,Tomcat的,JBoss的,WAS等的Weblogic 10.3.6发行过滤

下面是一些奇怪的问题,我得到的时候在WebLogic 10.3.6服务器中部署了相同的应用程序。

我在web.xml中有几个过滤器用于处理操作类之前的请求。这些过滤器在应用程序加载时进行初始化(调试进入init方法),当我点击URL时,它应该首先执行My Filter Classes的过滤器方法,但在使用weblogic时它不起作用。

相同的东西在其他Web应用程序服务器中也可以使用。

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> 
+0

您是否考虑在您的过滤器映射中添加“/*”或“ REQUEST”?这似乎是映射不起作用 –

+0

是的,我也试过,但没有希望。 –

回答

0

我发现,同时延长过滤器类,它需要添加@Override注释上述过滤器类方法。添加这解决了我的问题。

相关问题