Apr 5th, 2011, 11:39 AM
Spring Aspects JAR configured as an AJC/AJDT - rehashed
This really needs to get fixed...
Caused by: java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
This just happened again. Want to know how I fix it?
As noted here (http://stackoverflow.com/questions/3...-entitymanager)
I add the spring-aspects jar to my aspectJ path.
Want to know what I do then? I remove it and the tests go back to working again just like before when this error was not being thrown. I'll continue like this for a few hours/days until it happens again - seemingly randomly.
Seriously, this is silly.
Dec 9th, 2011, 02:48 AM
I was having it too and realized I had been trying to use the Data On Demand classes, that Spring Roo had generated for me, without starting up the Spring Framework. Your problem could have been about the lack of the Spring container too, I guess. Perhaps you referred to objects living there unknowingly.
Last edited by MiB; Dec 9th, 2011 at 04:55 AM.
Dec 10th, 2011, 04:18 AM
The message means that the EntityManager can't be autowired in an Entity.
You can also review the @ContextConfigurations of your tests, just in case you're using different applicatioContexts. This annotation is configured in the _Roo_IntegrationTest.aj and you can copy to the java file if you need so.
The aspects libraries are configured in the pom, make sure you have configured your maven project in your IDE if the issue comes from executing the unit tests individually.