Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java camelContext cvc 2.4.2找不到camelContext的错误_Java_Spring_Apache Camel - Fatal编程技术网

Java camelContext cvc 2.4.2找不到camelContext的错误

Java camelContext cvc 2.4.2找不到camelContext的错误,java,spring,apache-camel,Java,Spring,Apache Camel,我知道,也经历过很多类似的问题。但我仍然没有达到我错过的地方。我已经在名称空间中指定了最新的XSD。当我在WebSphere中运行时仍然会出现错误。但是我和Tomcat没有任何问题 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema

我知道,也经历过很多类似的问题。但我仍然没有达到我错过的地方。我已经在名称空间中指定了最新的XSD。当我在WebSphere中运行时仍然会出现错误。但是我和Tomcat没有任何问题

 <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
   http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
   http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
">



<bean id="xRoute" class="com.tgt.test.web.routes.GetXRoute" />
<bean id="yRoute" class="com.tgt.test.web.routes.YRoute" />
<bean id="zRoute" class="com.tgt.test.web.routes.ZRoute" />
    <camelContext id="camelContext" trace="true" xmlns="http://camel.apache.org/schema/spring">
   <routeBuilder ref="xRoute"/>
    <routeBuilder ref="yRoute"/>
    <routeBuilder ref="zRoute"/>
</camelContext>

错误:由以下原因引起:org.xml.sax.SAXParseException:cvc复杂类型。2.4.c:匹配的通配符是严格的,但找不到元素“camelContext”的声明


请让我知道为什么只有wbesphere会发生这种情况,而Tomcat不会。很抱歉问同样的问题。从昨天起我就一直在发疯。谢谢。我当时在Web sphere RSA环境中工作。它在使用TOMCAT容器的非EAR类型的项目结构中运行良好。但当我将代码移动到EAR类型的项目结构时,发生了

错误:原因:org.xml.sax.SAXParseException:cvc复杂类型。2.4.c:匹配的通配符是严格的,但找不到元素“camelContext”的声明

这意味着,Spring找不到元素çamelContext'的声明,该元素应该在“”中,该元素有一个名称空间引用->”,因此我检查了camel-sprin 2.12.1 jar中的camel-Spring.xsd文件,camelContext就在那里。然后我意识到驼峰spring jar没有被EAR识别,即使我已经为每个项目将它们添加到类路径(添加到类路径意味着,(properties/build path/add jars)

转到EAR/META_INF并添加每个项目的类路径中所需的所有JAR


这个解决方案解决了这个问题。虽然这浪费了我宝贵的48小时开发时间,但值得等待。我学到了更多。谢谢!

有人能帮我解决这个问题吗