Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.beans.NotReadablePropertyExcep tion Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.beans.NotReadablePropertyExcep tion

    I'm getting the following error message:

    Code:
    SEVERE: Servlet.service() for servlet [jcbulboard] in context with path [/jcbulboard] threw exception [org.springframework.beans.NotReadablePropertyException: Invalid property 'name' of bean class [java.util.ArrayList]: Bean property 'name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?] with root cause
    org.springframework.beans.NotReadablePropertyException: Invalid property 'name' of bean class [java.util.ArrayList]: Bean property 'name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
    	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:147)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:151)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:142)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:126)
    	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
    	at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
    	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at org.apache.jsp.WEB_002dINF.jsp.EnterBulletin_jsp._jspx_meth_form_005finput_005f0(EnterBulletin_jsp.java:409)
    	at org.apache.jsp.WEB_002dINF.jsp.EnterBulletin_jsp._jspx_meth_form_005fform_005f0(EnterBulletin_jsp.java:352)
    	at org.apache.jsp.WEB_002dINF.jsp.EnterBulletin_jsp._jspService(EnterBulletin_jsp.java:113)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1265)
    	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1016)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:965)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:792)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    This error comes after successfully running the following method in my controller.
    Code:
    	@RequestMapping(value = "/getApprovedBulletins", method = RequestMethod.POST)
    	public ModelAndView getApprovedBulletins(
    			@ModelAttribute("bulletin") Bulletin bulletin, BindingResult result) {
    		ModelAndView mav = new ModelAndView();
    
    		try {
    			List<Bulletin> bulletins = bulletinDAO.getApprovedBulletins();
    			mav.setViewName("EnterBulletin");
    			if (bulletins != null) {
    				mav.addObject("command", bulletins);
    			}
    		} catch (Exception e) {
    			System.out.println(e.getMessage());
    			mav.setViewName("FailurePage");
    		}
    
    		return mav;
    	}
    My intention is to use the ArrayList I'm putting in the ModelAndView object to list the bulletins at the top of the following JSP code, but I suspect the Spring container is trying to bind to the form at the bottom of the page. How do I fix this?
    Code:
    <body>
    	<h1>Job Connections Bulletin Board</h1>
    	<h2>Bulletin Entry</h2>
    	<b><font color="red"><c:out value='${confirmation}' /></font></b>
    	<c:remove var="confirmation" scope="session" />
    	<p>Here you can post comments, announce jobs, etc. All comments are
    		subject to approval.</p>
    	<p>
    		To search bulletins, click <a href="SearchPage.jsp">here</a>.
    	</p>
    	<c:forEach var="bulletin" items="${bulletins}">
    		<c:if test="${bulletin.approved}">
    			<c:url value="/getSingleBulletin"
    				var="{bulletin.name} -- {bulletin.subject}">
    				<c:param name="id">${bulletin.id}</c:param>
    			</c:url>
    			<br />
    			<br />
    		</c:if>
    	</c:forEach>
    	<form:form command="bulletin" method="post" action="/processBulletin">
    		<table>
    			<tr>
    				<td>Name:</td>
    				<td><form:input path="name" maxlength="30" /></td>
    			</tr>
    			<tr>
    				<td>Subject:</td>
    				<td><form:input path="subject" maxlength="50" /></td>
    			</tr>
    			<tr>
    				<td>Message:</td>
    				<td><form:textarea path="note" cols="50" rows="50" /></td>
    			</tr>
    			<tr>
    				<td><input type="button" value="Submit bulletin" name="submit" /></td>
    				<td>&nbsp;</td>
    			</tr>
    		</table>
    	</form:form>
    </body>

  • #2
    may be
    Code:
    mav.addObject("command", bulletins);
    Code:
    <c:forEach var="bulletin" items="${bulletins}">
    Replace ${bulletins} to ${command}

    Comment


    • #3
      This didn't work. I got basically the same error message. This is what's in the browser.

      Code:
      org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/EnterBulletin.jsp at line 33
      
      30: 		<table>
      31: 			<tr>
      32: 				<td>Name:</td>
      33: 				<td><form:input path="name" maxlength="30" /></td>
      34: 			</tr>
      35: 			<tr>
      36: 				<td>Subject:</td>
      
      
      Stacktrace:
      	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553)
      	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457)
      	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
      	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
      	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1265)
      	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1016)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:965)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
      	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:792)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      
      
      root cause 
      
      org.springframework.beans.NotReadablePropertyException: Invalid property 'name' of bean class [java.util.ArrayList]: Bean property 'name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
      	org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
      	org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
      	org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:147)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:151)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:142)
      	org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:126)
      	org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
      	org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
      	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.EnterBulletin_jsp._jspx_meth_form_005finput_005f0(EnterBulletin_jsp.java:409)
      	org.apache.jsp.WEB_002dINF.jsp.EnterBulletin_jsp._jspx_meth_form_005fform_005f0(EnterBulletin_jsp.java:352)
      	org.apache.jsp.WEB_002dINF.jsp.EnterBulletin_jsp._jspService(EnterBulletin_jsp.java:113)
      	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
      	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
      	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
      	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1265)
      	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1016)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:965)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
      	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:792)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

      Comment


      • #4
        Problem solved. I put the List<Bulletin> in the session object and put an instance of Bulletin in the command object. The code looks like this.

        Code:
        			List<Bulletin> bulletins = bulletinDAO.getApprovedBulletins();
        			mav.setViewName("EnterBulletin");
        			if (bulletins != null) {
        				ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
        						.currentRequestAttributes();
        				HttpSession session = attributes.getRequest().getSession(true);
        				session.setAttribute("bulletins", bulletins);
        				mav.addObject("command", new Bulletin());
        			}

        Comment

        Working...
        X