Page 3 of 3 FirstFirst 123
Results 21 to 21 of 21

Thread: How to store sample data

  1. #21
    Join Date
    Mar 2008
    Location
    Portland OR
    Posts
    44

    Default

    Hi,

    Nevermind... this question can be safely ignored. After rebuilding my project from the scripts I eliminated this problem. I think it originated in the Roo 1.2 upgrade of my project
    I have tried Ben's suggestion (using Roo 1.2.0 M1) like this,

    Code:
    	@Override
    	public void onApplicationEvent(ContextRefreshedEvent event) {
    		if (event instanceof ContextRefreshedEvent ) {
    			if (!User.findAllUsers().isEmpty()) {
                            ....
    but am getting an error complaining about the EntityManager not being injected. Has anyone else seen this?

    Code:
    011-10-16 13:11:23,032 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'insertTestData'
    2011-10-16 13:12:02,147 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
    java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
    	at com.kn.domain.User_Roo_Entity.ajc$interMethod$com_kn_domain_User_Roo_Entity$com_kn_domain_User$entityManager(User_Roo_Entity.aj:57)
    	at com.kn.domain.User.entityManager(User.java:1)
    	at com.kn.domain.User_Roo_Entity.ajc$interMethodDispatch1$com_kn_domain_User_Roo_Entity$com_kn_domain_User$entityManager(User_Roo_Entity.aj)
    	at com.kn.domain.User_Roo_Entity.ajc$interMethod$com_kn_domain_User_Roo_Entity$com_kn_domain_User$findAllUsers(User_Roo_Entity.aj:66)
    	at com.kn.domain.User.findAllUsers(User.java:1)
    	at com.kn.domain.User_Roo_Entity.ajc$interMethodDispatch1$com_kn_domain_User_Roo_Entity$com_kn_domain_User$findAllUsers(User_Roo_Entity.aj)
    	at com.kn.config.InsertTestData.initMe(InsertTestData.java:55)
    	at com.kn.config.InsertTestData.onApplicationEvent(InsertTestData.java:46)
    	at com.kn.config.InsertTestData.onApplicationEvent(InsertTestData.java:1)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
    	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
    	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:568)
    	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1282)
    Last edited by md10024; Oct 16th, 2011 at 11:57 PM.

Tags for this Thread

Posting Permissions

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