0
votes

I want to activate a camel route when a method in regular bean is called. To achieve this I am trying to get Camel proxy working to expose regular bean as service following the instruction from camel doc but get following exception

Stack Dump = org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 83 in XML document from ServletContext resource [/WEB-INF/applicationClientContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 83; columnNumber: 72; cvc-complex-type.2.4.a: Invalid content was found starting with element 'proxy'. One of '{"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, "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/schema/spring":route}' is expected.

I have intentionally changed http:// to h:// as site doesn't allow me to post more links.

My environment is IBM Liberty 8.5.5.4 profile on JDK 1.7 using Camel 2.14.1 and Spring 4. The route definition is below

<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

1 Answers

0
votes

For anyone who comes across this issue the solution I used is to use inject a endpoint using the annotations @Produce and @Consume which essentially setup the proxies undercover but this worked without any issues, documented here pojo endpoint injection