Spring 驼峰路线,发现以元素“开始的内容无效”;“数据格式”;
我的骆驼路线有问题,它无法识别我的“dataFormats”标记。我想我的名字空间可能有点问题,但我不太确定。任何帮助都将不胜感激。我的错误如下: 未能对项目ExactTargetSample:null:MojoExecutionException:InvocationTargetException:InvocationTargetException:文件[C:\EclipseWorkspace\EclipseWorkSpaceCurrent\ApacheCamel\target\classes\META-INF\spring\camel context.XML]中XML文档的第52行执行目标org.apache.camel:camel maven插件:2.10.4:run(默认cli)无效;嵌套异常为org.xml.sax.saxpasseeption;行号:52;栏目号:20;cvc复杂类型.2.4.a:发现以元素“dataFormats”开头的内容无效。“{”“:avro,”:beanio,”:bindy,“:castor,”:crypto,“:csv,”:custom,“:flatpack,”:gzip,“:hl7,”:jaxb,“:jibx,”:json,“:protobuf,”:rss,“:secureXML,”:serialization,“:soapjaxb,”:string,“:syslog,“:tidyMarkup,”:xmlBeans,“:xmljson,”:xstream,“:pgp,”:zip}应为“->[帮助1]Spring 驼峰路线,发现以元素“开始的内容无效”;“数据格式”;,spring,activemq,apache-camel,Spring,Activemq,Apache Camel,我的骆驼路线有问题,它无法识别我的“dataFormats”标记。我想我的名字空间可能有点问题,但我不太确定。任何帮助都将不胜感激。我的错误如下: 未能对项目ExactTargetSample:null:MojoExecutionException:InvocationTargetException:InvocationTargetException:文件[C:\EclipseWorkspace\EclipseWorkSpaceCurrent\ApacheCamel\target\classes
我的路线副本可在下面找到:
<?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>
一切看起来都很好。您可能错过了将camel jackson依赖项添加到pom的过程。只是猜测而已
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>${camel-version}</version>
</dependency>
org.apache.camel
骆驼杰克逊
${camel版本}
结果是我忘了在数据格式前面加上“camel”,因为我是在名称空间声明中声明的。完全跳过了。谢谢你的帮助!