Servicemix專家需要一些幫助。無法創建路由,原因是:找不到具有方案的組件:activemq
我在apache servicemix中部署了一個web服務。這個web服務是從在同一臺機器上部署在tomcat上的web應用程序啓動的。我想從Web服務發送自定義消息到activemq:queue。
Web服務代碼:
@Path("/cdlService/")
public class TestService {
private BundleContext bundleContext;
@GET
@Path("/startProcess/{user}/{isbn}")
@Produces("application/xml")
public String startProcess(@PathParam("user") long userId, @PathParam("isbn") String isbn){
System.out.println("id : " + userId + " , isbn : " + isbn);
CamelContext camelContext = new DefaultCamelContext();
try {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("in process method");
System.out.println(exchange.getExchangeId() + " : " + exchange.getFromRouteId() + " : " + exchange.isFailed());
}
}).to("activemq:queue:testQueue");
}
});
camelContext.setTracing(true);
camelContext.start();
} catch (Exception e1) {
e1.printStackTrace();
}finally{
if(camelContext != null){
try {
camelContext.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return "started";
}
}
我想送用戶id和ISBN從Web服務到testqueue。這個web服務使用apache cxf框架實現。下面
是我的beans.xml被放置在資源/ META-INF /彈簧
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
<jaxrs:server id="testService" address="/test">
<jaxrs:serviceBeans>
<ref bean="testSvc"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="testSvc" class="com.qait.cdl.web.service.TestService"/>
</beans>
我在ServiceMix的作爲束由行家束-插件部署上述示例應用程序。當我點擊上面的網絡服務,比它給我以下錯誤:
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[activemq:queue:testQueue] <<< in route: Route(route1)[[From[direct:start]] -> [process[com.qait.cdl.... because of Failed to resolve endpoint: activemq://queue:testQueue due to: No component found with scheme: activemq