Java 春天<;jee:jndi查找>;标签及标签`SAXParseException`
以下是我的Spring上下文Java 春天<;jee:jndi查找>;标签及标签`SAXParseException`,java,spring,Java,Spring,以下是我的Spring上下文.xml文件的摘录 <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/batch" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schem
.xml
文件的摘录
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<beans:import
resource="classpath:com/batch/jobs/data-source-context.xml" />
<job id="xxxx">
<step id="loadRecord">
<tasklet>
<chunk reader="dtaFileItemReader" writer="dtaGroupWriter"
commit-interval="${job.commit.interval}" />
</tasklet>
</step>
</job>
<jee:jndi-lookup id="dataSource" jndi-name="jdbc"></jee:jndi-lookup>
<beans:bean id="incrementerParent" class="${batch.database.incrementer.class}">
<beans:property name="dataSource" ref="dataSource" />
<beans:property name="incrementerName" value="ID" />
</beans:bean>
看起来spring在运行时没有找到
org/springframework/ejb/config/spring-jee-3.0.xsd
此文件位于spring-context-3.0.x.RELESE.jar中,请检查此文件的部署是否正确。您将spring(beans、aop和tx)2.0与spring 3.0中的JEE模式混合使用,这可能会导致问题。您在某处有一个不正确的命名空间声明,可能是针对beans和JEE的 根据,JEE XMLNS声明应为:
<?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:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<!-- <bean/> definitions here -->
</beans>
btw:you使用spring-beans-2.0
你想升级到3.0吗?你是对的。下载了Spring的新版本并更改了所有名称空间。现在它可以正常工作了。谢谢。请确保上下文xml中的命名空间定义都指向同一版本。
<?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:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<!-- <bean/> definitions here -->
</beans>