我在下面得到这个例外,因为我使用的xsd不正确,请告知如何克服这个
下面的是我正在使用的xsd
<?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:int="http://www.springframework.org/schema/integration"
xmlns:jms="http://www.springframework.org/schema/integration/jms"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.4.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
以下是我正在使用的罐子
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/crimson.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jaxp.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jcert.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jms.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jndi.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jnet.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jsse.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/jta-spec1_0_1.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibcrypt.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibjms.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibjmsadmin.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibjmsapps.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibrvj.jar"/>
<classpathentry kind="lib" path="C:/Release12/lib/thirdparty/tibco-ems/4.2.0/tibrvjms.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring-jms.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/commons-lang-2.6.jar/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="C:/tibco/log4j-1.2.9.jar"/>
<classpathentry kind="lib" path="C:/tibco/spring-context-2.0.4.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/org-apache-commons-logging.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-core-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-event-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-feed-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-file-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-ftp-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-groovy-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-http-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-httpinvoker-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-ip-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-jdbc-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-jms-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-jmx-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-mail-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-rmi-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-security-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-sftp-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-stream-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-test-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-twitter-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-ws-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-xml-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring integration/spring integration/spring-integration-xmpp-2.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/org.springframework.jms-3.1.0.M1.jar/org.springframework.jms-3.1.0.M1.jar"/>
<classpathentry kind="lib" path="C:/xerces.jar/xerces.jar"/>
<classpathentry kind="lib" path="C:/xercesImpl.jar/xercesImpl.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring-core-3.1.1.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring-2.5.jar"/>
<classpathentry kind="lib" path="C:/abcsaral/sprintintegrationn/spring-beans-3.0.5.RELEASE.jar"/>
我得到的例外是
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from class path resource [jms-spring-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 116; cvc-elt.1: Cannot find the declaration of element 'beans'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:369)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:184)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at com.apress.prospringintegration.test.main(test.java:23)
Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 116; cvc-elt.1: Cannot find the declaration of element 'beans'.
大家请告知如何克服这个问题,这个问题是否与classpath有关
答案 0 :(得分:0)
看来您的默认命名空间是bean。我猜你有bean:第11行的bean,只使用没有bean前缀的bean(bean class =&#34; ....&#34;)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
HTH
答案 1 :(得分:0)
对Spring命名空间使用“无版本”XSD定义。
尽量使用最后一个Spring jar版本。
首先看起来你有一个版本的混乱,从另一方面,所有这些都是旧的,他们已经没有维护。
无论如何,您应该显示您的donwstream XML。 Manespace定义不足以确定该问题。
尝试从标记中清除XML并逐个恢复它们以捕获犯罪者。
另一方面,它可能只是一个Eclipe问题,当打开Spring Nature for project时应解决问题。