我收到以下错误:
引起:org.xml.sax.SAXParseException:cvc-elt.1:找不到元素'beans'的声明。
我的context.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="no"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="fileParser" class="com.xxx.xx.xx.oxm.FileInputParser" >
<property name="unmarshaller" ref ="jaxb2Marshaller" />
</bean>
<bean id = "jaxb2Marshaller" class = "org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name = "classesToBeBound">
<array>
<value>com.xxx.xx.xx.oxm.XutoxenPathInfo</value>
</array>
</property>
</bean>
</beans>
答案 0 :(得分:0)
您的schemaLocation
编写错误。该位置需要遵循命名空间名称。
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
你的不这样做。这是
beansNS
contextNS
contextLocation
beansLocation