Unexpected error occurred in scheduled task.

SpringBoot 2 定时任务本机测试成功,但是服务器无法运行。提示错误如下

Unexpected error occurred in scheduled task.
java.lang.NullPointerException: null

详细错误如下,由于项目是放到服务器上才会报错的。所以不得不输出log到服务器上,然后查看log的方法来排除bug。

2019-01-21 11:30:00.028 ERROR 2483 --- [scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task.

java.lang.NullPointerException: null
        at com.saikul.dataRepository.InfoFromPlatformRepository.getAes(InfoFromPlatformRepository.java:40) ~[classes/:0.0.1-SNAPSHOT]
        at com.saikul.common.ScheduledService.getListsFromAPI(ScheduledService.java:21) ~[classes/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0]
        at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0]
        at java.lang.Thread.run(Thread.java:744) [na:1.8.0]

其实细看我的程序:给出的提示其实很明显了,他提示我的代码底40 行出现了问题。
那么就可以确定问题不再定时任务或者服务器上,只能是在自己的写的代码上出了问题。

查看log好一番尝试之后才发现我写的代码中AES加密的那一部分,代码本机的jdk编译出来和linux 服务器上编译以出来的aes码。完全不一样,管不得总是提示空指针异常,肯定是我根据错误的aes码去请求api服务器肯定请求不到数据的。

你可能感兴趣的:(Unexpected error occurred in scheduled task.)