Camel Context cvc 2.4.2 error which doesnt find the camelContext

こ雲淡風輕ζ 提交于 2019-12-14 03:12:42

问题


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>

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'.

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


回答1:


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

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'.

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,

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

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!



来源:https://stackoverflow.com/questions/23354161/camel-context-cvc-2-4-2-error-which-doesnt-find-the-camelcontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!