Reputation: 1141
I am having an issue with my camel route and it not recognizing my "dataFormats" tag. I think I may have something wrong with my namespaces but I am not sure exactly. Any help would be greatly appreciated. My error is the following:
Failed to execute goal org.apache.camel:camel-maven-plugin:2.10.4:run (default-cli) on project ExactTargetSample: null: MojoExecutionException: InvocationTargetException: Line 52 in XML document from file [C:\EclipseWorkspaces\EclipseWorkSpaceCurrent\ApacheCamel\target\classes\META-INF\spring\camel-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 52; columnNumber: 20; cvc-complex-type.2.4.a: Invalid content was found starting with element 'dataFormats'. One of '{"http://camel.apache.org/schema/spring":avro, "http://camel.apache.org/schema/spring":beanio, "http://camel.apache.org/schema/spring":bindy, "http://camel.apache.org/schema/spring":castor, "http://camel.apache.org/schema/spring":crypto, "http://camel.apache.org/schema/spring":csv, "http://camel.apache.org/schema/spring":custom, "http://camel.apache.org/schema/spring":flatpack, "http://camel.apache.org/schema/spring":gzip, "http://camel.apache.org/schema/spring":hl7, "http://camel.apache.org/schema/spring":jaxb, "http://camel.apache.org/schema/spring":jibx, "http://camel.apache.org/schema/spring":json, "http://camel.apache.org/schema/spring":protobuf, "http://camel.apache.org/schema/spring":rss, "http://camel.apache.org/schema/spring":secureXML, "http://camel.apache.org/schema/spring":serialization, "http://camel.apache.org/schema/spring":soapjaxb, "http://camel.apache.org/schema/spring":string, "http://camel.apache.org/schema/spring":syslog, "http://camel.apache.org/schema/spring":tidyMarkup, "http://camel.apache.org/schema/spring":xmlBeans, "http://camel.apache.org/schema/spring":xmljson, "http://camel.apache.org/schema/spring":xstream, "http://camel.apache.org/schema/spring":pgp, "http://camel.apache.org/schema/spring":zip}' is expected. -> [Help 1]
And a copy of my route can be found below:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- load properties -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="file:backend.properties" />
</bean>
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="file:backend.properties" />
</bean>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://0.0.0.0:61616?useLocalHost=true" />
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
<property name="maxConnections" value="8" />
<property name="maximumActive" value="500" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="transacted" value="false" />
<property name="concurrentConsumers" value="1" />
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<!-- Custom Loaded Beans -->
<bean id="TriggeredSendBean" class="com.backend.trigger.ClientTest"/>
<!-- camel configuration -->
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<json id="WelcomeEmail" library="Jackson" unmarshalTypeName="com.testObjects.EnrollResponse" />
<dataFormats>
<camel:route id="genericMessageHandler" streamCache="true">
<from uri="activemq:topic:Test.Central" />
<unmarshal ref="WelcomeEmail" />
<to uri = "bean:TriggeredSendBean?method=setup" />
<to uri = "bean:TriggeredSendBean?method=addSubscriberAllList" />
<to uri = "bean:TriggeredSendBean?method=sendWelcomeEmail" />
</camel:route>
</camel:camelContext>
Upvotes: 0
Views: 6020
Reputation: 11
Everything looks good. May be you missed to add the camel-jackson dependency to your pom. Just a guess !
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>${camel-version}</version>
</dependency>
Upvotes: 1