试图让Camel代理工作以将常规bean公开为服务但获得异常

时间:2015-02-15 00:30:13

标签: proxy apache-camel websphere-liberty

我想在调用常规bean中的方法时激活camel路由。为了实现这一点,我试图让Camel代理按照camel doc的指令将常规bean公开为服务但是得到以下异常

  

Stack Dump = org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自ServletContext资源[/WEB-INF/applicationClientContext.xml]的XML文档中的第83行无效;嵌套异常是org.xml.sax.SAXParseException; lineNumber:83; columnNumber:72; cvc-complex-type.2.4.a:从元素' proxy'开始发现无效内容。 ' {" h://camel.apache.org/schema/spring":redeliveryPolicyProfile," h://camel.apache.org/schema/spring" :onException," h://camel.apache.org/schema/spring" ;: onCompletion," h://camel.apache.org/schema/spring":intercept,& #34; h://camel.apache.org/schema/spring":interceptFrom," h://camel.apache.org/schema/spring":interceptSendToEndpoint," h ://camel.apache.org/schema/spring" ;: restConfiguration," h://camel.apache.org/schema/spring" ;: rest," h:// camel .apache.org /模式/弹簧":路线}'预计。

我故意将http://更改为h://,因为网站不允许我发布更多链接。

我的环境是使用Camel 2.14.1和Spring 4在JDK 1.7上的IBM Liberty 8.5.5.4配置文件。路由定义在下面

<beans xmlns="h://www.springframework.org/schema/beans"
xmlns:xsi="h://www.w3.org/2001/XMLSchema-instance"

xmlns:ws="h://jax-ws.dev.java.net/spring/core"
xmlns:wss="h://jax-ws.dev.java.net/spring/servlet"      

xmlns:tx="h://www.springframework.org/schema/tx"
xmlns:context="h://www.springframework.org/schema/context"

xmlns:camel="h://camel.apache.org/schema/spring"

xsi:schemaLocation="h://www.springframework.org/schema/beans h://www.springframework.org/schema/beans/spring-beans-4.0.xsd
h://jax-ws.dev.java.net/spring/core h://jax-ws.java.net/spring/core.xsd 
h://jax-ws.dev.java.net/spring/servlet h://jax-ws.java.net/spring/servlet.xsd

h://www.springframework.org/schema/tx h://www.springframework.org/schema/tx/spring-tx.xsd    
h://www.springframework.org/schema/context h://www.springframework.org/schema/context/spring-context-4.0.xsd
h://camel.apache.org/schema/spring h://camel.apache.org/schema/spring/camel-spring.xsd">    

.
.
.
.

<!-- BeanImpl The bean is defined out side of the camel  -->
<bean id="mathService" class="com.adp.sbs.bean.service.MathServiceBeanImpl"/>

<camelContext trace="true" xmlns="h://camel.apache.org/schema/spring">

<!--  Creates a proxy to the direct:mathy endpoint. -->
<proxy id="mathProxy" serviceInterface="com.adp.sbs.service.IMathService" serviceUrl="direct:mathy" />

<export id="mathy" uri="direct:mathImpl" serviceRef="mathService"
                serviceInterface="com.adp.sbs.service.IMathService"/>


<route>
<from uri="direct:mathy"/>
<bean ref="mathService" method="add(*,*)"/>
<to uri="file:data/outbox/MathResult.txt"/>
</route>

1 个答案:

答案 0 :(得分:0)

对于遇到此问题的任何人,我使用的解决方案是使用注释@Produce和@Consume注入端点,它基本上设置了秘密代理,但这没有任何问题,在此处记录pojo endpoint injection