我正在使用 Spring 3.0 开发 swing 项目,并且正在使用 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”的声明。
这是我的弹簧配置文件
<?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 并运行它时,会出现错误。请给我一些建议谢谢。