当我在独立模式下启动camel时,我收到一条消息,表明我的路由正在使用我设置的端点消耗:
Route: route1 started and consuming from: Endpoint[http://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer]
大!
但是当我切割&过去在[]进入我的浏览器之前我得到的是404。 当然,如果Camel说它在该地址消耗,我应该可以使用该地址联系我的Rest网络服务。
这是我的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
有人能发现我做错了吗?
谢谢,
安德鲁
答案 0 :(得分:1)
您在CXF RS bean和Java注释中有重复的路径设置。两者将合并,因此最终的网址将类似于http://localhost:9090/hrm/hrm_push
+ "/hrm/"
+ "/hrm_push/"
,这可能不是您想要的。
建议使用CXF RS bean仅定义基本URL,然后将Java注释用于其他所有内容。