繁体   English   中英

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

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

我正在使用Spring 3.0开发swing项目,并且正在使用eclipse IDE,该项目可以在IDE中找到,但是当我生成jar文件时运行它。 发生错误org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自类路径资源[spring-beans.xml]的XML文档中的第13行无效; 嵌套的异常是org.xml.sax.SAXParseException; lineNumber:13; columnNumber:84; cvc-elt.1:找不到元素'beans'的声明。

这是我的弹簧配置文件

   <?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>

我正在搜索该错误并在我的项目中测试了解决方案,但还不行。 代码工作在IDE中找到。但是当我生成可运行的jar并运行时,这给了我错误。 请给我一些建议,谢谢。

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

暂无
暂无

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

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