Results 1 to 8 of 8

Thread: petclinic sample

  1. #1
    Join Date
    Mar 2007
    Posts
    113

    Default 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:

    Code:
    Internal error
    org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: 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 org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:143) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:336) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:323) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:824) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:769) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:613) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:536) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Thread.java:619) 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(PetType.java:1) 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(PetTypeController.java:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:575) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:139) ... 28 more Cookies: JSESSIONID=[CEA726FB9B273A9D6D79FF96A58E3A58]
    i'm using the spring source tool suite, jdk 1.6, deployed to tomcat.

    ideas? thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3
    Join Date
    Mar 2007
    Posts
    113

    Default

    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. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Superb, glad it's working for you!
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  5. #5
    Join Date
    May 2009
    Posts
    2

    Default 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. #6
    Join Date
    Mar 2007
    Posts
    113

    Default

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

    hope this helps!..ROO rocks!

  7. #7
    Join Date
    May 2009
    Posts
    2

    Default 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. #8
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Pengo, glad it worked for you. Thanks also for sharing the details of using AJDT 1.7.0.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •