Apache camelとquartzスケジューラの新機能です。私はそれらを統合の両方で使用しようとしていますが、それを行うことはできません。私は「キャメル・イン・アクション」の本で小さな記事を見つけましたが、私はプログラムを実行することもできませんでした - ここに私のコードですクォーツスケジューラでApache camelを使用する際の問題
パッケージcom.cockpitconfig.schedulars;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class TestScheduler {
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
context.disableJMX();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from(
"quartz://myTimer?trigger.repeatInterval=2000&trigger.repeatCount=-1")
.setBody().simple("Current time is ").to("stream:out");
}
});
context.start();
Thread.sleep(10000);
context.stop();
}
}
しかし、それは誰もがこの問題の解決策を持っていますエラーに
Exception in thread "main" java.lang.InstantiationError: org.quartz.SimpleTrigger
at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:119)
at org.apache.camel.component.quartz.QuartzComponent.createEndpoint(QuartzComponent.java:54)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:419)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:47)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:189)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:73)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:751)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:174)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:610)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1514)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1306)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
at com.cockpitconfig.schedulars.TestScheduler.main(TestScheduler.java:24)
を与えていますか?