简体   繁体   English

运行jar时找不到元素'beans'的声明错误

[英]Cannot find the declaration of element 'beans' error occur when run jar

I am developing swing project with Spring 3.0 and I am using eclipse IDE , the project is work find in IDE but when I produce jar file run it. 我正在使用Spring 3.0开发swing项目,并且正在使用eclipse IDE,该项目可以在IDE中找到,但是当我生成jar文件时运行它。 An Error occur org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from class path resource [spring-beans.xml] is invalid; 发生错误org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自类路径资源[spring-beans.xml]的XML文档中的第13行无效; nested exception is org.xml.sax.SAXParseException; 嵌套的异常是org.xml.sax.SAXParseException; lineNumber: 13; lineNumber:13; columnNumber: 84; columnNumber:84; cvc-elt.1: Cannot find the declaration of element 'beans'. cvc-elt.1:找不到元素'beans'的声明。

Here is my spring config file 这是我的弹簧配置文件

   <?xml version="1.0" encoding="UTF-8"?> 
     <beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:tx="http://www.springframework.org/schema/tx"  
     xmlns:p="http://www.springframework.org/schema/p" 
     xsi:schemaLocation=" 
        http://www.springframework.org/schema/beans      
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
        http://www.springframework.org/schema/tx  
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
        http://www.springframework.org/schema/context  
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:annotation-config/> 
    <context:component-scan base-package="com.plyd.java"/>
  </beans>

I am googling that error and test the solution in my project but not ok. 我正在搜索该错误并在我的项目中测试了解决方案,但还不行。 The code work find in IDE.But when I produce runnable jar and run this give me error. 代码工作在IDE中找到。但是当我生成可运行的jar并运行时,这给了我错误。 Please give me some advise Thank. 请给我一些建议,谢谢。

如果您使用的是Eclipse,请尝试使用>> 将所需的库复制到子文件夹中 ,以使用此导出jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM