我正在尝试在Servicemix 4上运行一个CXF端点。我创建了一个带有CXF端点的Spring原型,并使用Maven成功安装了它。运行osgi:install -s mvn:它安装到Servicemix上,但日志显示:
Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=springdm,
config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 21 in XML document
from URL [bundle://218.0:0/META-INF/spring/camel-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no
declaration can be found for element 'cxf:cxfEndpoint'
我之前在Camel文件中使用以下内容构建了此路由:
<beans ...
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/tranposrts/camel http://cxf.apache.org/tranposrts/camel.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<cxf:cxfEndpoint id="wspoc"
address="http://localhost:8181/ws/ping"
serviceClass="net.ja.smx.springdm.PongImpl" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:wspoc"/>
<to uri="activemq:helloQ" />
</route>
</camelContext>
这是一个正在运行的Camel上下文文件的克隆,但我看不出为什么ServiceMix在启动时抛出错误。唯一的区别是pom文件不使用CXF作为依赖项,但它在我从在线示例中获取的部分中。
对于任何缺少导入或更正上下文文件的任何指针或我应该检查的任何内容,我将不胜感激。
非常感谢。
答案 0 :(得分:2)
发布后不久,我发现我错过了我的POM文件中的camel-cxf依赖项,导致此错误。我还需要确保它是正确的版本,因为这导致ServiceMix中找到正确的META.cxf文件时出错。