How to use Spring Roo with Apache Wicket?

692 Views Asked by At

I have a persistence layer (JPA entity objects) created and managed by Roo. It is in its own project, builds to a jar, and I have used it with a separate Spring MVC 3 web application.

I'd like to use this same Roo persistence project in another web application powered by Apache Wicket. I have seen a couple of the Roo add-ons made for Wicket, but none of them even compile (I'm not the only one to have the issue).

The problem I am encountering is that whenever I try to call one of my Roo entities from within a Wicket Page or component, I get the following exception:

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.x.domain.UserAccount_Roo_Entity.ajc$interMethod$com_x_domain_UserAccount_Roo_Entity$com_x_domain_UserAccount$entityManager(UserAccount_Roo_Entity.aj:91)
at com.x.domain.UserAccount.entityManager(UserAccount.java:1)

I have configured my application following the Spring+Wicket wiki here: https://cwiki.apache.org/WICKET/spring.html

Does anyone know the 1,2,3 steps to set up a Wicket application to utilize Spring Roo entities? Any help is appreciated. Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

I found the solution to my problem. When I ran my wicket webapp using the Maven jetty:run goal, it worked. However, I was trying to start Jetty via Java code:

public class Start {

public static void main(String[] args) throws Exception {
    Server server = new Server();
    SocketConnector connector = new SocketConnector();
    server.start();
    }
}

I was not loading the Spring ApplicationContext in this "Start" class. Once I modified this class to load the Spring application context, it worked

1
On

I found this in google code, sounds like its doing exactly what you want http://code.google.com/p/spring-roo-wicket-addon/