gpt4 book ai didi

java - Camel Context cvc 2.4.2错误找不到camelContext

转载 作者:行者123 更新时间:2023-12-02 05:53:15 27 4
gpt4 key购买 nike

我知道并且经历过很多类似的问题。但我仍然没有得到我错过的地方。我已在 namespace 中指定了最新的 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-complex-type.2.4.c:匹配通配符严格,但找不到元素“camelContext”的声明。

请告诉我为什么这种情况只发生在 wbesphere 而不是 Tomcat。很抱歉问了同样的问题。从昨天开始我就一直很头疼。谢谢

最佳答案

我在 Web sphere RSA 环境中工作。它在带有 TOMCAT 容器的非 EAR 类型的项目结构中运行良好。但是当我将代码移至 EAR 类型的项目结构时,发生了

错误: 引起:org.xml.sax.SAXParseException:cvc-complex-type.2.4.c:匹配通配符严格,但找不到元素“camelContext”的声明。

这意味着,Spring 无法找到 Element çamelContext' 的声明,该声明应该位于“http://camel.apache.org/schema/spring”中,该声明具有命名空间引用 ->“http://camel.apache.org/schema/spring/camel-spring.xsd”所以我检查了camel-spring.xsd在camel sprin 2.12.1 jar 中的文件中,camelContext 就在那里。然后我意识到 EAR 无法识别camel-spring jar,即使我已将它们添加到类路径中(添加到类路径意味着每个项目的(属性/构建路径/添加 jars)。所以解决方案是,

到达 EAR/META_INF 并添加每个项目的类路径中所需的所有 jar。

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

关于java - Camel Context cvc 2.4.2错误找不到camelContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23354161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com