从类路径资源[config / FaceBookSimulator.xml]解析XML文档时出现意外异常;

时间:2016-06-28 06:26:32

标签: java linux spring spring-boot

运行spring程序时出错。我的程序如下:

enter image description here

我的程序读取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中运行

0 个答案:

没有答案