`

在websphere6中部署应用遇到的struts问题

阅读更多
在一个应用程序包部署到websphere6中后,出现一下异常:
[07-1-15 19:18:47:234 CST] 00000027 ActionServlet E   Parsing error processing resource path
[07-1-15 19:18:47:250 CST] 00000027 ActionServlet E   TRAS0014I: 下列异常已记录 java.net.MalformedURLException: SRVE0238E: 资源路径应该以斜杠开头
 at com.ibm.ws.webcontainer.webapp.WebApp.getResource(WebApp.java:1915)
 at com.ibm.ws.webcontainer.facade.ServletContextFacade.getResource(ServletContextFacade.java:100)
 at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1002)
 at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
.
.
.
java.net.MalformedURLException: SRVE0238E: 资源路径应该以斜杠开头
...
该应用包在websphere5.x中部署正常,后发现websphere使用的struts版本问题.
Struts 1.1 中,获得资源路径时,前面不带斜线( / ),但在Servlet 2.4规范中,要求在获得一个资源路径时,路径必须是相对与当前上下文根并以斜线( / )开头,WebSphere Application Server 5.x中使用的是struts1.1版本规则,而websphere6则使用了Servlet 2.4版本的规则,故导致问题出现.
解决办法是:利用websphere6兼容websphere5.x的方法:
具体为:
在WebSphere6 管理控制台中,进入 服务器->对应的服务器名称 -> WEB容器设置->WEB容器 -> 其他属性->定制属性 ->添加
添加下面的属性:
名称:prependSlashToResource
值:true

重启websphere即可. 

 

 

===补充,因为上面的问题,后来查了文档:发现还有个注意点:这个不知道会不会出现,这里先急着:

 

§JSP useBean tag
4Tightened conformance to JSP 1.2
4Old: <jsp:useBean id="pg" class="exp.ObjExp.exampleTbl" scope="request" />
4New: <jsp:useBean id="pg" type="exp.ObjExp.exampleTbl" scope="request" />

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics