2

我正在努力获得一个简单的 cxf:rsServer 来监听端口。
我的应用上下文:

<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问题和那个异常

  1. 我正在独立运行骆驼,所以我认为我不需要 Servlet。
  2. pushServer 使用的是 tcp:// 而不是 http://
  3. 变压器是一个pojo,对HTTP一无所知

问题:在大多数关于 cxf:rsServer 的 xml 示例中,我看到 jaxrs:server 已配置。这是我没有的一件事。我需要吗?谢谢阅读。欢迎所有建议。

安德鲁

4

1 回答 1

3

jaxrs:server示例中显示的是模拟远程 REST Web 服务以完成路由示例。

  • 路由来自:cxf:rsServer
  • 路由至:cxf:rsClient

CXF RS 客户端需要将消息发送到某个地方,这就是运行在不同端口上的 JAX RS 服务器的用途。

由于您上面的路由目的地是其他东西(日志组件),因此您不需要 JAX RS 服务器配置。

于 2014-01-17T21:14:31.430 回答