Announcement Announcement Module
No announcement yet.
petclinic sample Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • petclinic sample

    hi, when i try to run the petclinic sample application, i can create a pet type, but when i try to list them, i get this error:

    Internal error Failed to invoke handler method [public java.lang.String com.springsource.petclinic.web.PetTypeController.create(com.springsource.petclinic.reference.PetType,org.springframework.validation.BindingResult)]; nested exception is java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?) at at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod( at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle( at org.springframework.web.servlet.DispatcherServlet.doDispatch( at org.springframework.web.servlet.DispatcherServlet.doService( at org.springframework.web.servlet.FrameworkServlet.processRequest( at org.springframework.web.servlet.FrameworkServlet.doPost( at javax.servlet.http.HttpServlet.service( at javax.servlet.http.HttpServlet.service( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal( at org.springframework.web.filter.OncePerRequestFilter.doFilter( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at at org.springframework.web.filter.OncePerRequestFilter.doFilter( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at org.apache.catalina.core.StandardWrapperValve.invoke( at org.apache.catalina.core.StandardContextValve.invoke( at org.apache.catalina.core.StandardHostValve.invoke( at org.apache.catalina.valves.ErrorReportValve.invoke( at org.apache.catalina.core.StandardEngineValve.invoke( at org.apache.catalina.connector.CoyoteAdapter.service( at org.apache.coyote.http11.Http11Processor.process( at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( at$ at Caused by: java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?) at com.springsource.petclinic.reference.PetType_Roo_Entity.ajc$interMethod$com_springsource_petclinic_reference_PetType_Roo_Entity$com_springsource_petclinic_reference_PetType$persist(PetType_Roo_Entity.aj:35) at com.springsource.petclinic.reference.PetType.persist( at com.springsource.petclinic.reference.PetType_Roo_Entity.ajc$interMethodDispatch1$com_springsource_petclinic_reference_PetType_Roo_Entity$com_springsource_petclinic_reference_PetType$persist(PetType_Roo_Entity.aj) at com.springsource.petclinic.web.PetTypeController_Roo_Controller.ajc$interMethod$com_springsource_petclinic_web_PetTypeController_Roo_Controller$com_springsource_petclinic_web_PetTypeController$create(PetTypeController_Roo_Controller.aj:14) at com.springsource.petclinic.web.PetTypeController.create( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at at ... 28 more Cookies: JSESSIONID=[CEA726FB9B273A9D6D79FF96A58E3A58]
    i'm using the spring source tool suite, jdk 1.6, deployed to tomcat.

    ideas? thanks

  • #2
    Did you run this through Web Tools Project in STS?

    I'd recommend you try running the application outside of STS initially. To do that run "mvn package" and deploy the resulting WAR to Tomcat manually. You'll see it works just fine.

    The reason your error is displayed in WTP is you probably have AJDT 1.6.4 or earlier. As noted in the readme.txt, you need AJDT 1.6.5 or above installed in STS. Otherwise it will not automatically add spring-aspects-*.jar to the aspects path. This in turn means Spring's @Configurable capability does not work, and we rely on that working for the entity manager to be injected into the entity. So you need to either update STS to AJDT 1.6.5 or alternatively manually add spring-aspects-*.jar to your aspects path. I recommend AJDT 1.6.5 because it also has a lot of enhancements to code assist and has various other stability improvements that will make your Roo experience more enjoyable.


    • #3
      Thanks. For some reason, my project didn't refresh after updating to AJDT 1.6.5. After refreshing, things are working great.

      Looking forward to the next release...


      • #4
        Superb, glad it's working for you!


        • #5
          I have the same problem using AJDT 1.7.0

          I use Eclipse 3.5 + AJDT 1.7.0, and have the same problem.

          The org.springframework.aspects-3.0.0.M2.jar is already in the "Java build path", is it right?


          • #6
            I'm using STS (SpringSource Tool Suite), version 2.1.0.M1, which is eclipse built for Spring. I'm using version of AJDT.

            hope this helps!..ROO rocks!


            • #7
              Finally, solved

              Thank you, jnl001

              I tried STS, and it worked. But I prefer eclipse 3.5, so I tried again, with AJDT 1.7.0

              AJDT 1.7.0 is not like AJDT 1.6.5, and there is nothing in "AspectJ Build -> Aspect Path". When I click "Add JARs..." button to add the springframework-aspects-*.jar, it says "Duplicate build entry found: xxx", the OK button is disabled. But, when I use "Add Library..." to add the "Maven Dependencies" to the path, it is OK, and it works.


              • #8
                Pengo, glad it worked for you. Thanks also for sharing the details of using AJDT 1.7.0.