测试中发现(未完全测试),使用netbeans IDE 6.9.1 生成应用的web.xml文件,在jboss5.1.0.GA中部署EJB3的应用,需要注意顺序,否则会提示servlet not found的错误。暂未找到原因,记录到这里,便于查询。
jboss5开始,检查更加严格,jboss4可以部署的,jboss5就会有问题,呵呵。
1、netbeans生成的web.xml顺序
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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"> //上下文参数在一起 <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>model</param-name> <param-value>true</param-value> </context-param> //过滤器 <filter> <filter-name>myfilters</filter-name> <filter-class>myfilter</filter-class> </filter> //监听器 <listener> <listener-class>mylisters</listener-class> </listener> //servlet,如果有2个以上,就放在一起了 <servlet> <servlet-name>FacesServlet</servlet-name> <servlet-class>com</servlet-class> </servlet> <servlet> <servlet-name>myfaces</servlet-name> <servlet-class>myfaces</servlet-class> </servlet> //servlet-mapping,如果有2个以上,就放在一起了 <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>myfaces</servlet-name> </servlet-mapping> //session-config <session-config> <session-timeout> 30 </session-timeout> </session-config> </web-app>
2、jboss5.1.0.GA可以正常部署的顺序
//监听器 <listener> <listener-class>MyListener</listener-class> </listener> //上下文参数 <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> //servlet与servlet-mapping,必须连续放置 <servlet> <servlet-name>FacesServlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> //过滤器及映射,必须连续放置 <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>