开发者

What causes "NoSuchMethodError: org.springframework.beans.BeanWrapper.setAutoGrowCollectionLimit(I)V?"

I've a Maven project with Spring and Hibernate. When I compile the project it's all right, but when I run it in tomcat I found these errors:

   org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/contact.jsp at line 16

    13:  
    14:     <table>
    15:     <tr>
    16:         <td><form:label path="firstname"><spring:message code="label.firstname"/></form:label></td>
    17:         <td><form:input path="firstname" /></td>
    18:     </tr>
    19:     <tr>


    Stacktrace:
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    root cause

    javax.servlet.ServletException: java.lang.NoSuchMethodError: org.springframework.beans.BeanWrapper.setAutoGrowCollectionLimit(I)V
        org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
        org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
        org.apache.jsp.WEB_002dINF.jsp.contact_jsp._jspService(contact_jsp.java:99)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    root cause

    java.lang.NoSuchMethodError: org.springframework.beans.BeanWrapper.setAutoGrowCollectionLimit(I)V
        org.springframework.validation.BeanPropertyBindingResult.getPropertyAccessor(BeanPropertyBindingResult.java:94)
        org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:98)
        org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:225)
        org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
        org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174)
        org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194)
        org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:129)
        org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:119)
        org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:89)
        org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
        org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
        org.apache.jsp.WEB_002dINF.jsp.contact_jsp._jspx_meth_form_005flabel_005f0(contact_jsp.java:208)
        org.apache.jsp.WEB_002dINF.jsp.contact_jsp._jspx_meth_form_005fform_005f0(contact_jsp.java开发者_开发知识库:130)
        org.apache.jsp.WEB_002dINF.jsp.contact_jsp._jspService(contact_jsp.java:83)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

I think that the most important problem is :

org.springframework.beans.BeanWrapper.setAutoGrowCollectionLimit(I)V

but I don't understand its origin. Could anybody help me please?

Thanks!


The error says it all: the method setAutoGrowCollectionLimit doesn't exist on the version of class BeanWrapper that gets loaded into memory. Usually this is a classpath problem caused by an older or otherwise incompatible version of a JAR on your classpath.

In this case, look for spring-core.jar files in your WEB-INF/lib, your EAR (if you have one), and various library directories of the app server. Make sure that you only have one copy, and that it's the same version you compile against.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜