Hi,
I used STS (SpringSource Tool Suite) to create a web project based on Spring Batch Admin, and then I added a servlet to that project because I want to call jobs from that servlet. However when I try to invoke jobs from the servlet, the jobs are not being located in the application context...
The above code results in the below error...Code:ServletContext servletContext =this.getServletContext(); WebApplicationContext applicationContext = WebApplicationContextUtils. getRequiredWebApplicationContext(servletContext); JobLauncher launcher = (JobLauncher) applicationContext .getBean("jobLauncher"); Job job = (Job) applicationContext.getBean("simpleJob");
I have attached the web.xml and servlet code to this email.Code:org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'simpleJob' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:505) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1040) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:272) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1004) at com.wu.interstream.advising.servlets.AdviseAgents.doGet(AdviseAgents.java:75)
SimpleJob is a standard job that comes as part of the Spring Batch Admin template. It is defined in the module-context.xml which is loaded when the Batch Servlet (also an Admin standard) is loaded.
Thanks in advance for any help,
Jehan


Reply With Quote