0
我使用駱駝2.14.0和新的休息dsl功能。看起來異常從句不適用於其他dsl。我做錯了什麼?這裏是我的課程:異常子句可以在駝峯2.14.0中使用rest dsl嗎?
public MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
restConfiguration.component("servlet").bindingMode(RestBindingMode.json);
onException(RuntimeException.class).process(new MyProcessor()).stop();
rest("/test")
.get("/error")
.route()
.bean(MyClassRaiseException.class, "test");
}
}
public MyClassRaiseException {
public void test() {
throws new RuntimeException("TEST");
}
}
public MyProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
System.out.println("This line of code is not executed");
}
}
MyProcessor未被調用。請幫助!
請確認我們也該測試()確實調用。 – user2504380 2014-10-08 08:30:34
可能重複的[Apache Camel onException](http://stackoverflow.com/questions/14198043/apache-camel-onexception) – user2504380 2014-10-08 08:30:46
test()確實被調用,因爲我可以在控制檯中看到錯誤堆棧跟蹤。 – 2014-10-08 14:38:54