was 报Error 404: SRVE0190E: File not found

(1)第一种,我的was是6.1,然后用了Struts之后,就发生这样的问题 

was 升级后,登录页面提交请求login.action ,页面报Error 404 错误:Error 404: SRVE0190E: File not found: /login.action 
was升级后如果部配置com.ibm.ws.webcontainer.invokefilterscompatibility属性,部署的struts应用提交请求就不起作用。 

要将Struts2部署到WAS上,需要在WAS上添加一个参数com.ibm.ws.webcontainer.invokeFiltersCompatibility=true. 
默 认情况下,WAS是不处理用户自定义的filter中的URI映射,而Struts2需要 org.apache.struts2.dispatcher.FilterDispatcher拦截所有的请求并且处理Struts2标签。所以不作处 理的话你会发现Struts2的项目发布在WAS上无效。 
解决方法如下: 

进入控制台-》服务器-》应用程序服务器-》Web 容器 > 定制属性 
选择新建 
com.ibm.ws.webcontainer.invokefilterscompatibility 
值为true。 
保存后,重新启动was服务器。 

详细的可以参考: 
http://www-01.ibm.com/support/docview.wss?uid=swg24014758 
http://www-01.ibm.com/support/docview.wss?rss=180&uid=swg21284395 
http://www.frightanic.com/2010/05/10/solution-to-error-404-srve0190e-on-websphere-6-1/ 

(2)第二种情况比较少见,但是我实际遇到,找了好久才解决的。同样报的错误是Error 404: SRVE0190E: File not found。 
   场 景;在was 6.0中我在server端写了一个rest服务,web.xml加载的是一个filter,然后client端请求这个rest时候是通 过服务器端的filter去过滤的。但实际情况是,fielter被呼叫了,rest也被call到了,但是client端却一直报错 误:Error 404: SRVE0190E: File not found: /rest。意思是说我的rest url找不到,可是跟踪后台 log 明明都被执行了,为什么还会找不到url呢? 
    这个问题让我费解,找了两天最后才找到解决方法,就是在server端的web.xml中再增加一个simpleServlet,这样就不会报错了: 

Java代码   收藏代码

<servlet>  

               <servlet-name>FileServlet</servlet-name>  

               <servlet-class>  

                       com.ibm.ws.webcontainer.servlet.SimpleFileServlet  

               </servlet-class>  

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

       </servlet>  

  

       <servlet-mapping>  

               <servlet-name>FileServlet</servlet-name>  

               <url-pattern>/*</url-pattern>  

       </servlet-mapping>  


有兴趣的可以参考: 
http://groups.google.com/group/google-guice/browse_thread/thread/493af2e2d5f0ea16/4971253e99f4a202

猜你喜欢

转载自chenhongbinjs.iteye.com/blog/1874722