본문으로 바로가기

유효성 검사 hibernate를 적용해보는 과정에서 생긴 에러이다.



심각: Servlet.service() for servlet [jsp] threw exception
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'mvo' available as request attribute
 at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
 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.views.join.step2_jsp._jspx_meth_form_005finput_005f0(step2_jsp.java:376)
 at org.apache.jsp.WEB_002dINF.views.join.step2_jsp._jspService(step2_jsp.java:174)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:444)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
 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:1180)
 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
 at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
 at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:407)
 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Unknown Source)



해결 방법 :


1. Controller.java 에서 @ModelAttribute 있는지 확인.


@RequestMapping(value="/register")
public String join(@ModelAttribute("memberVO") @Valid MemberVO memberVO, BindingResult bindingResult){


혹은


2. 

컨트롤러의 @ModelAttribute("memberVO") @Valid MemberVO memberVO 와 

jsp의 <form:form action="/register/step3" commandName="memberVO"> 이

같아야함.



댓글을 달아 주세요

  1. BlogIcon 하루히즘 2021.03.10 21:47 신고

    저도 @ModelAttribute를 빼먹었네요 ㅋㅋㅋ 감사합니다

  2. BlogIcon 상진 2022.02.04 11:17 신고

    감사합니다~