gpt4 book ai didi

java - Apache Camel 在使用quartz 调度程序调度 ftp 端点时抛出 java.lang.NullPointerException

转载 作者:行者123 更新时间:2023-12-02 01:41:40 26 4
gpt4 key购买 nike

我正在尝试使用camel-quartz2在Spring Boot应用程序中调度FTP端点。但是,在应用程序启动时,它会抛出空指针异常。

下面是 FTP URI 的代码片段

private final String NBP_GMI_TRADE_DAILY_FTP_CONNECTION_URI = "ftp://<username>@<hostip>/NBP/GMI/?password=<password>"
+ "&disconnect=true"
+ "&idempotent=true"
+ "&idempotentKey=${file:name}-${file:size}"
+ "&sendEmptyMessageWhenIdle=true"
+ "&filter=#nbpGmiTradeDailyFileFilter"
+ "&passiveMode=true"
+ "&binary=true"
+ "&recursive=true"
+ "scheduler=quartz2"
+ "&scheduler.cron=0+0/2+*+?+*+SUN,SAT+*";

FTP Camel 配置

from(NBP_GMI_TRADE_DAILY_FTP_CONNECTION_URI)
.routeId("NBP_GMI_TRADE_DAILY_FTP_ROUTE")
.choice()
.when(simple("${body} != null")).setHeader(Exchange.FILE_NAME,simple("${file:name.noext}_${date:now:yyyyMMddHHmmssSSS}.${file:ext}")).to("file://{{user.home}}/NBP/data/daily/backup/?fileName=${date:now:yyyyMMdd}/${file:name}").end();

在应用程序启动时,我遇到以下异常

        org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.NullPointerException
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:225) ~[camel-spring-boot-2.19.3.jar:2.19.3]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:52) ~[camel-spring-boot-2.19.3.jar:2.19.3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at com.fis.derivatives.utility.nbp.Application.main(Application.java:36) [classes/:na]
Caused by: java.lang.NullPointerException: null
at org.apache.camel.impl.DefaultScheduledPollConsumerScheduler.startScheduler(DefaultScheduledPollConsumerScheduler.java:145) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.ScheduledPollConsumer.startScheduler(ScheduledPollConsumer.java:456) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.component.file.remote.FtpConsumer.doStart(FtpConsumer.java:67) ~[camel-ftp-2.19.3.jar:2.19.3]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3514) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3831) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3767) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3687) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3451) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3305) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:202) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3089) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3085) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3108) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3085) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3022) ~[camel-core-2.19.3.jar:2.19.3]
at org.apache.camel.spring.boot.RoutesCollector.maybeStart(RoutesCollector.java:242) ~[camel-spring-boot-2.19.3.jar:2.19.3]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:217) ~[camel-spring-boot-2.19.3.jar:2.19.3]
... 13 common frames omitted

我分别使用以下版本的 spring-boot 和 apache Camel

spring-boot: 1.5.6.RELEASE
apache-camel: 2.19.3

任何帮助将不胜感激。

最佳答案

我看到您的端点字符串中有:“scheduler=quartz2”,这应该是“&scheduler=quartz2”。您还可以检查是否包含 camel-quartz2camel-quartz2-starter 依赖项吗?

关于java - Apache Camel 在使用quartz 调度程序调度 ftp 端点时抛出 java.lang.NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54387067/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com