posts - 84, comments - 54, trackbacks - 0, articles - 0
   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

在JSP中有这样一行代码:

<td class="FormContents">
<fmt:formatDate value="${usr.userCreDate}" pattern="dd-MMM-yyyy" />
</td>

在WebSphere Portal6中运行时报错:
Nested Exception is com.ibm.ws.jsp.JspCoreException: Unable to convert string '${usr.userCreDate}' to class java.util.Date for attribute value: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
         at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:
930)
         at com.ibm._jsp._userEnquiry._jspx_meth_fmt_formatDate_0(_userEnquiry.java:
1624)
         at com.ibm._jsp._userEnquiry._jspService(_userEnquiry.java:
643)
         at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:
91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:
856)

 

而该JSP在Portal 5中确定是没问题的。利用Google找到一个类似的问题,有人做了如下 的解答:

1) Declare web.xml as Servlet 2.5.
2) Remove all loose JSTL tld files from your classpath. Those are already included in the JSTL JAR file.
3) Remove the TLD declarations from your web.xml. Those are already declared in the JSTL JAR's web.xml.
4) I recommend to remove the JSTL and Standard JAR's and use JSTL 1.2 instead: jstl-1.2.jar. Just place it in the classpath (YourWebApp/WEB-INF/lib or Tomcat/lib) and declare the @taglib in your JSP to use it. Nothing more, nothing less. Do not extract the JAR and duplicate the stuff everywhere.

再三检查后,以上4点在移植过程中都已经注意了,除了Servlet是2.4以外,但是应该和这个没关系。

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns
="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
</web-app>

 

既然原因不在这里,就只有另外想办法,根据错误信息,忽然想到尽管WEB-INF/lib中的jstl.jar没问题,但是是否加载到了这个jar呢。打开EAR项目下的application.xml,转到Deployment,将Classloader Mode设置为PARENT_LAST。重启发布项目后,问题解决。
该设置的物理位置在{EAR}\META-INF\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\deployment.xml中

<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1236654129452">
  
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1236654129452" startingWeight="10">
    
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1236654129452" startingWeight="10000" uri="MyPortal_Web.war"/>
    
<classloader xmi:id="Classloader_1236654129452" mode="PARENT_LAST"/>
  
</deployedObject>
</appdeployment:Deployment>

评论

# re: 从Websphere Portal5移植Web应用到Websphere Portal6时fmt:formatDate报错的解决  回复  更多评论   

2009-03-16 14:05 by Amber
谢谢啦 我正好遇到这个问题 都晕了

只有注册用户登录后才能发表评论。


网站导航: