Natural

 

自己遇到的struts错误[不定期更新]

1、javax.servlet.ServletException: BeanUtils.populate[2010-05-10]
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: BeanUtils.populate
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.company.filter.RequestCharacterEncodingFilter.doFilter(Unknown Source)

root cause

java.lang.IllegalArgumentException: argument type mismatch
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
    org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
    org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
    org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
    org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.company.filter.RequestCharacterEncodingFilter.doFilter(Unknown Source)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
问题原因:类型匹配异常。

比较常见的一种情况:时间属性string 和date的拷贝;
还有一种情况:form的某个属性关联了对象,此时该属性名不能作为action提交时的参数名。
例:
这是配置文件;
<action path="/myAction" type="com.actions.MyAction" scope="request" name="myForm">
如果myForm中的某个属性为Object abc;(即多对一等方式关联了某个对象),
此时访问了“/myAction.do?abc=某值”会出现这个异常


2、org.apache.jasper.JasperException: Null property value for 'bmid'[2010-05-11]
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Null property value for 'bmid'
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
    org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
    org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:320)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.company.filter.RequestCharacterEncodingFilter.doFilter(Unknown Source)

root cause

java.lang.IllegalArgumentException: Null property value for 'bmid'
    org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:755)
    org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
    org.apache.commons.beanutils.BeanUtils.getArrayProperty(BeanUtils.java:529)
    org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:309)
    org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:244)
    org.apache.jsp.person.xfxw.xfxwreceive_005fnew_jsp._jspx_meth_html_select_0(xfxwreceive_005fnew_jsp.java:178)
    org.apache.jsp.person.xfxw.xfxwreceive_005fnew_jsp._jspService(xfxwreceive_005fnew_jsp.java:115)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
    org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
    org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:320)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.company.filter.RequestCharacterEncodingFilter.doFilter(Unknown Source)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28
问题原因:jsp所使用html标签的属性是formBean中的一个对象,但在formBean的构造方法中没有初始化

例:
<html:select property="bmid.id">                   
<
html:optionsCollection name="bmidList" />
</html:select>
对应的formBean中的构造方法没有对bmid对象进行初始化。

posted on 2010-05-10 15:49 此号已被删 阅读(619) 评论(0)  编辑  收藏 所属分类: Struts


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


网站导航:
 

导航

统计

常用链接

留言簿(8)

随笔分类(83)

随笔档案(78)

文章档案(2)

相册

收藏夹(7)

最新随笔

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜