Spring aspectj jar not configured correctly

I get this error when I try to use a JPA object created by Roo.

An entity manager has not been entered (is this a Spring Aspects JAR parameter configured as an AJC / AJDT library?)

I followed consultations on the Internet to add spring -aspects.jar path to aspectj in Eclipse, but I still get this error. Does anyone know how to solve this?

I am using Spring 3.0.5, Hibernate 3.6, and JBoss 6.0.0.Final.

+7
source share
5 answers

Go to the STS ROO console (right-click in the project in STS, then Spring Tools, then open Spring Roo) Enter a prompt to perform a cleanup (execute Maven clean) Then enter the eclipse command

That should work!

+1
source

It looks like you did not enter Entity Manager.

Webapps (possible reasons):

  • You have not added factory entity manager to your applicationContext.xml

Java Applications :

  • You have not added factory entity manager to your applicationContext.xml
  • Incorrect application initialization (see below)

    public class SampleApp { public static void main(String[] args) { SampleApp obj = new SampleApp(); // Injecting dependencies into application ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("<PATH-TO>/applicationContext.xml"); applicationContext.registerShutdownHook(); applicationContext.getBeanFactory().autowireBeanProperties( obj, AutowireCapableBeanFactory.AUTOWIRE_NO, false); // Do the work } } 
+1
source

I had this problem too, and I found the answer here: http://whyjava.wordpress.com/2012/02/13/fixing-exception-entity-manager-has-not-been-injected-is-the-spring -aspects-jar-configured-as-an-ajcajdt-aspects-library /

In my case, I needed to create a file named <classname>_Roo_Configurable.aj with the following contents:

privileged aspect <classname>_Roo_Configurable { declare @type: <classname>: @Configurable; }

This explains why the existing classes worked, but the new ones I created did not. The file _Configurable.aj did not display (and still does not display) in the package explorer in STS.

(I know this answer is incredibly late, but I hope this helps someone else!)

+1
source

I had the same problem and fixed it by running Spring Tools | Include Spring Tool Aspects in my project.

My classes were created by Roo and clicked (I had too many problems with it), and I just added them to a completely new Google web application project that I created (so it uses a GAE application layout with a military directory, and not one Maven for anything, at least not yet).

0
source

You need to create a repository for the pointing domain.

At the start of roo-terminal, execute the script

es.

  repository jpa --interface ~.dao.MyDomainDAO --entity ~.domain.MyDomain 
0
source

All Articles