0

当我以独立模式启动骆驼时,我收到一条消息,表明我的路线正在从我设置的端点消耗:

Route: route1 started and consuming from: Endpoint[http://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer]

伟大的!

但是,当我将 [] 之间的内容切入浏览器时,我得到一个 404。当然,如果 Camel 说它正在那个地址消费,我应该能够使用该地址联系我的 Rest web 服务。

这是我的 appContext

<bean id="transformer" class="com.xxxx.portlistener.services.Transformer">
</bean> 

<cxf:rsServer id="pushServer" 
              address="http://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer" >
    <cxf:serviceBeans>
        <ref bean="transformer" />
    </cxf:serviceBeans>
</cxf:rsServer>          

<cxf:rsServer id="pingServer" 
              address="http://localhost:9090/hrm/hrm_ping" >
    <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.xxxx.portlistener.services</package>
    <camel:route id="route1">
           <camel:from uri="cxfrs://bean://pushServer"/> 
           <camel:to uri="log:TEST?showAll=true" />
    </camel:route>   
    <camel:route id="route2">
           <camel:from uri="cxfrs://bean://pingServer"/> 
           <camel:to uri="log:TEST?showAll=true" />
    </camel:route>            
</camel:camelContext>

我的服务接口:

@Path("/hrm/")
public interface PushService
{
/**
 * trasform will change the given Object....
 */
@POST
@Produces("text/plain")
@Path("/hrm_push/")
public Response pusher(Object pushee);

@GET
@Produces("text/plain")
@Path("/hrm_ping/")
public Response ping();
}

来自控制台的错误:

Jan 21, 2014 10:45:50 AM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor processRequest
WARNING: No root resource matching request path / has been found.
Jan 21, 2014 10:45:51 AM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available

谁能发现我做错了什么?

谢谢,

安德鲁

4

1 回答 1

1

您在 CXF RS bean 和 Java 注释中有重复的路径设置。两者将合并,因此最终 URL 将类似于http://localhost:9090/hrm/hrm_push++ "/hrm/""/hrm_push/"这可能不是您想要的。

建议使用 CXF RS bean 仅定义基本 URL,然后将 Java 注释用于其他所有内容。

于 2014-01-21T21:54:34.773 回答