2
我正在努力获得一个简单的cxf:rsServer来侦听端口。
我appContext:使用camel时,cxf:rsServer是否需要jaxrs:server?
<bean id="transformer" class="com.xyxx.portlistener.services.Transformer">
</bean>
<cxf:rsServer id="pushServer"
address="tcp://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer;resourceClasses=com.xyxx.portlistener.services.Transformer" >
<cxf:serviceBeans>
<ref bean="transformer" />
</cxf:serviceBeans>
</cxf:rsServer>
<!-- Camel Configuration -->
<camel:camelContext id="camel-1" xmlns="http://camel.apache.org/schema/spring">
<package>com.xyxx.portlistener.services</package>
<camel:route id="route1">
<camel:from uri="cxfrs://bean://pushServer"/>
<camel:to uri="log:TEST?showAll=true" />
</camel:route>
</camel:camelContext>
我的例外:
MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
我的骆驼版本2.4.0的pom.xml:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-hl7</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mina</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel.version}</version>
</dependency>
3混淆了HTTP问题和异常
- 我以单机运行骆驼,所以我不认为我需要一个Servlet。
- pushServer使用TCP://而不是http:/
- 变压器是一个POJO和一无所知HTTP
问:In most of the xml examples regarding cxf:rsServer我见过JAXRS:服务器配置。这是我没有的一件事。我需要它吗? 感谢您的阅读。所有建议都欢迎。
安德鲁
我解决了NoClassDef问题,将camel-http添加到了pom中。我仍然想知道cxfrs是否需要jaxrs:server。他们可能不是,但我不知道为什么代码是在我看到的例子中。 – KingAndrew