运行spring程序时出错。我的程序如下:
我的程序读取xml文件:
public static void main(String[] args) {
//String springConfig = "src/main/resources/config/FacebookSimulator.xml";
//String springConfig = "/root/fbdata/FacebookSimulator.xml";
String springConfig = "/config/FacebookSimulator.xml";
//ApplicationContext context = new FileSystemXmlApplicationContext(springConfig);
ApplicationContext context = new ClassPathXmlApplicationContext(springConfig);
JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
Job job = (Job) context.getBean("simulatorJob");
这在windows中工作得很好。但是在linux下运行时会出现如下错误:
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [config/FaceBookSimulator.xml]; nested exception is org.springframework.beans.FatalBeanException: Class [org.springframework.batch.core.configuration.xml.CoreNamespaceHandler] for namespace [http://www.springframework.org/schema/batch] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
我的问题是我应该把facebook.xml
放在linux系统中。
我把它作为一个jar并在linux中运行