我试图让一个代理在OSGi中正确工作(通过Karaf完成),并通过gradle构建。
我的蓝图文件(名称已被更改以保护无辜):
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<!-- Service proxy export for the Camel direct proxy route -->
<service id="postRoutableMessageService" interface="foo.bar.intf.RoutableMessagePoster" ref="postRoutableMessageProxy" ranking="1000">
<service-properties>
<entry key="protocol">
<value type="java.lang.String">Direct</value>
</entry>
</service-properties>
</service>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<proxy id="postRoutableMessageProxy" serviceUrl="direct:postRoutableMessage" serviceInterface="foo.bar.intf.RoutableMessagePoster"/>
<!-- Load all routes from the specified package -->
<package>foo.bar.foo</package>
</camelContext>
</blueprint>现在,这个蓝图文件是不可接受的。当我通过gradle构建来运行一个(非常)简单的测试时,我得到了以下错误:
错误2015-03-26 17:58:54,284蓝图扩展程序:1 org.apache.aries.blueprint.container.BlueprintContainerImpl doRun -无法启动OMDDProxyRouteTest OMDDProxyRouteTest的蓝图容器无法验证xml
。。。
由:org.xml.sax.SAXParseException引起;cvc-complex- with .2.4.a:从元素'package‘开始发现无效内容。{“http://camel.apache.org/schema/blueprint”:模板,“http://camel.apache.org/schema/blueprint”:使用者模板,“http://camel.apache.org/schema/blueprint”:代理,“http://camel.apache.org/schema/blueprint”:导出,“http://camel.apache.org/schema/blueprint”:“错误处理程序”,"http://camel.apache.org/schema/blueprint":routeBuilder,“http://camel.apache.org/schema/blueprint”:“http://camel.apache.org/schema/blueprint”,"http://camel.apache.org/schema/blueprint":restContextRef,“http://camel.apache.org/schema/blueprint”:线程proxy,“http://camel.apache.org/schema/blueprint”:线程池,“http://camel.apache.org/schema/blueprint”:终结点,“http://camel.apache.org/schema/blueprint”“:dataFormats”,“http://camel.apache.org/schema/blueprint”:“>”>“http://camel.apache.org/schema/blueprint”异常"http://camel.apache.org/schema/blueprint":onCompletion,“http://camel.apache.org/schema/blueprint”:截取,“http://camel.apache.org/schema/blueprint”:从中调解,“http://camel.apache.org/schema/blueprint”:代偿http://camel.apache.org/schema/blueprint,“http://camel.apache.org/schema/blueprint”:恢复配置,"http://camel.apache.org/schema/blueprint":rest,“http://camel.apache.org/schema/blueprint”:路由}。
我对此感到非常困惑,因为它在抱怨骆驼上下文中的标签。我在其他地方使用了完全相同的语法(只是一个不同的包),没有问题。
最后一个“错误”是,所有的事情最终都会崩溃:
java.lang.RuntimeException:放弃等待服务(objectClass=org.apache.camel.CamelContext)
这是有意义的,因为元素在元素中。
尽管如此,我还是不知道为什么会失败。如果我移除package元素,一切都很好,测试就会运行并通过,所以它实际上就是这个发臭的元素(或者它与某人交互的方式)。
帮我奥比旺克诺比,你是我唯一的希望(也许)。
次要问题:我是否正确定义了代理端点及其必要的公开服务?
发布于 2015-03-27 09:55:28
交换<proxy>和<package>在<camelContext>中的顺序。这些元素需要按照特定的顺序排列。
https://stackoverflow.com/questions/29289727
复制相似问题