Announcement Announcement Module
Collapse
No announcement yet.
error in SimpleFormController Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error in SimpleFormController

    Hello,

    I need some help with my Controller which extends an SimpleFormController. My application is deployed in Tomcat 6.0. When I look into the logfiles in Tomcat I can see that the variables written by Log4J has been assigned with correct values. I do that in the method doSubmitAction.

    The next statement to be executed is in my case to create a project which I do in the ProjectService object by the method createProject.

    This is my error;Line 69 is the statement projectService.createProject(projectDao). I don't know why this happens. Maybe someone can help me with this?


    java.lang.NullPointerException
    businessLayer.controller.CreateProjectController.d oSubmitAction(CreateProjectController.java:69)
    org.springframework.web.servlet.mvc.SimpleFormCont roller.onSubmit(SimpleFormController.java:442)
    org.springframework.web.servlet.mvc.SimpleFormCont roller.onSubmit(SimpleFormController.java:408)
    org.springframework.web.servlet.mvc.SimpleFormCont roller.onSubmit(SimpleFormController.java:380)
    org.springframework.web.servlet.mvc.SimpleFormCont roller.processFormSubmission(SimpleFormController. java:267)
    org.springframework.web.servlet.mvc.AbstractFormCo ntroller.handleRequestInternal(AbstractFormControl ler.java:250)
    org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:153)
    org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:45)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:820)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:755)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:396)
    org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:360)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)

  • #2
    Your service likely isn't wired up correctly, ie, its not being initialized hence the infamous NPE.

    Comment


    • #3
      Agreed. Specifically, it looks like you need a projectService set as a property on your controller, and it isn't being set.

      Comment


      • #4
        dispatcher-servlet.xml

        In my dispatchere-servlet.xml i have configured a bean name like this;

        <bean name="/createProject.htm" class="businessLayer.controller.CreateProjectContr oller">
        <property name="formView">
        <value>createProject</value>
        </property>
        <property name="successView">
        <value>readProject</value>
        </property>
        </bean>

        I wonder how to configure my ProjectService as att attribute in this file?

        Comment

        Working...
        X