发布应用程序到websphere6需要注意的问题

    就在刚才我把项目的东西都搞完之后,用myeclipse打包出来,准备开始发布到was6上面,奇怪的是每次发布总是显示错误,看信息是web.xml有问题,  但是我在tomcat上都成功发布的,tomcat上是可以正常使用的。距离下班还有一个小时,要是东西还没整好,工程总监非得杀了我不可!当时把我急[align=center][/align]得真像是热锅上的蚂蚁,眼看就差最后一步竟然整这出事!没办法,自己重新导了几次包,把包里的由myeclipse里自动生成的文件都删了,检查了好几遍,想到的方法都试了,还是不行,最后只能求助网络!网上的说法是当web.xml里配置了多个filter的时候 <filter>标签和<filter-mapping>标签之前不能嵌套,也就是说把所有的<filter>放一起,<filter-mapping>另外放一起!总算看到希望了!改好之后,重新发布,结果依然不行!看来除了这个<filter>之外还有别的标签存放的顺序有问题,经查找才发现是 
<session-config>
  <session-timeout>30</session-timeout>
  </session-config> 这个引起的错误!
下面我把改之前web.xml和改过之后的贴上来,以此为鉴!
改之前的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!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>
  <display-name>Manager</display-name>

  <filter>
    <filter-name>TransCharFilter</filter-name>
    <description>字符格式的转换,处理form提交的中文问题</description>
    <filter-class>com.powerunion.util.web.TransCharFilter</filterclass>
    <init-param>
      <param-name>inputCharset</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>TransCharFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
  <filter-name>AuthFilter</filter-name>
  <filter-class>com.powerunion.manager.util.filter.AuthFilter</filter-class>
  </filter>
 
  <filter-mapping>
  <filter-name>AuthFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
  </filter-mapping>

  <session-config>
  <session-timeout>30</session-timeout>
  </session-config>

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <taglib>
    <taglib-uri>/WEB-INF/powerunion-common.tld</taglib-uri>
    <taglib-location>/WEB-INF/powerunion-common.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>


</web-app>


改过之后的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!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>
  <display-name>Manager</display-name>

  <filter>
    <filter-name>TransCharFilter</filter-name>
    <description>字符格式的转换,处理form提交的中文问题</description>
    <filter-class>com.powerunion.util.web.TransCharFilter</filter-class>
    <init-param>
      <param-name>inputCharset</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter>
  <filter-name>AuthFilter</filter-name>
  <filter-class>com.powerunion.manager.util.filter.AuthFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>TransCharFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
  <filter-name>AuthFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
  </filter-mapping>


  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <session-config>
  <session-timeout>30</session-timeout>
  </session-config>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <taglib>
    <taglib-uri>/WEB-INF/powerunion-common.tld</taglib-uri>
    <taglib-location>/WEB-INF/powerunion-common.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>


</web-app>

改过后的web.xml除了更改了filter标签的顺序,还把<session-config>移到了 <servlet-mapping>的下面!

你可能感兴趣的:(java,apache,Web,struts,网络应用)