Camel Context cvc 2.4.2错误,找不到camelContext [英] Camel Context cvc 2.4.2 error which doesnt find the camelContext

查看:23
本文介绍了Camel Context cvc 2.4.2错误,找不到camelContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道并经历过很多类似的问题.但我仍然没有得到我错过的地方.我已经在名称空间中指定了最新的 xsds.在 Web Sphere 中运行时仍然出现错误.但是我对 Tomcat 没有任何问题.

I know and had been through a lot of similar problems like this. But still i am not getting where i am missing out. I have specified the latest xsds in name space. Still i get the error when i run in Web Sphere. But i dont get any problems with 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"的声明.

ERROR: Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'.

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

please let me know why this happens only with wbesphere but not with Tomcat. And Sorry for asking for same question.I have been breaking my head since yesterday.Thanks

推荐答案

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

I was working in Web sphere RSA Environment. It was working fine in a NON EAR type of Project Structure with TOMCAT Container. But when i moved my code to EAR type of Project Structure, It occured that

错误: 由:org.xml.sax.SAXParseException:cvc-complex-type.2.4.c:匹配的通配符是严格的,但找不到元素camelContext"的声明.

ERROR: Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'.

这意味着,Spring 无法在http://camel.apache.org/schema/spring" 有一个命名空间引用 -> "http://camel.apache.org/schema/spring/camel-spring.xsd" 所以我检查了camel sprin 2.12.1 jar 中的camel-spring.xsd 文件,camelContext 在那里.然后我意识到 EAR 无法识别骆驼弹簧罐,即使我已将它们添加到类路径(添加到类路径意味着,(属性/构建路径/添加罐子)为每个项目.所以解决方案是,

Which means , the Spring coudnt find a declaration for the Element çamelContext'which is supposed to be there in "http://camel.apache.org/schema/spring" which had a namespace reference -> "http://camel.apache.org/schema/spring/camel-spring.xsd" So i check the camel-spring.xsd file in camel sprin 2.12.1 jar, the camelContext was there. Then i recognized that the the camel-spring jar was not recognized by the EAR,even though i have added them to classpath (adding to class path means, (properties/build path/add jars) for each project. So the solution is,

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

got to EAR/META_INF and add all the jars which are required in the class path for each project.

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

This solution solved the issue.Though this wasted almost 48 hours of my precious development time, it was worth the wait. I learnt more. Thanks!

这篇关于Camel Context cvc 2.4.2错误,找不到camelContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆