【发布时间】:2014-02-21 15:46:20
【问题描述】:
我正在使用 Spring 3.0 和 我正在使用 eclipse IDE ,该项目是在 IDE 中找到的,但是当我生成 jar 文件时运行它。 发生错误 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自类路径资源 [spring-beans.xml] 的 XML 文档中的第 13 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:13;列号:84; cvc-elt.1:找不到元素“beans”的声明。
这是我的 spring 配置文件
<?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 中使用的 JRE 是否与您在命令行中使用的相同?例如。两者是相同的供应商/版本,还是不同的版本,相同的供应商,还是不同的供应商?
-
@PaulGrime 是的,两个 JRE 都是一样的。