Announcement Announcement Module
Collapse
No announcement yet.
Accessing DataOnDemand Objects from main method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing DataOnDemand Objects from main method

    I am trying to call some of my service methods from the main function and coming against this error.
    Code:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roodRunner' defined in file ... Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class ... Constructor threw exception; nested exception is java.lang.NoClassDefFoundError [RoodRunner]: : Lcom...LocationDataOnDemand
    Is it possible to use DOD objects like this?

    Here is a portion of my runner class

    Thanks in advance.
    Z.
    Code:
    @Component
    @Configurable
    @ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext*.xml")
    public class RoodRunner {
    	
    	
    	
    	@Autowired
    	LocationDataOnDemand ldod;
    	@Autowired
            MyService myService;
    	@Autowired
    	MyDataOnDemand cdod;
    	@Autowired 
    	 MyRepository myRepository;
    	 My my;
    	@Autowired
    	 LocationService myLocationService;
    
    	
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		
    		 ApplicationContext ac= 
    			        new ClassPathXmlApplicationContext("classpath*:META-INF/spring/applicationContext*.xml");
    
    		 RoodRunner runner = ac.getBean(RoodRunner.class);
    		 
    		My testMy =  runner.cdod.getNewTransientMy(0);
    		Location location =  runner.ldod.getNewTransientLocation(0);
                    testMy.setLocation(location);
    		runner.myService.saveMy(testMy);
    		
    		
    		runner.myService.updateMy(testMy);
    	}
    	
    }
Working...
X