SpringBoot 2 Timing Task Native Test was successful, but the server could not run. The prompt error is as follows
Unexpected error occurred in scheduled task.
java.lang.NullPointerException: null
Detailed errors are as follows, because the project is placed on the server will report errors. So you have to output the log to the server, and then look at the log method to eliminate the 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]
In fact, look closely at my program: the prompt is very obvious, he prompted me that the bottom 40 lines of code had problems.
Then you can make sure that the problem is no longer a timed task or on the server, but only on your own code.
After checking the log for a long time, I found the part of AES encryption in the code I wrote. The jdk of the code machine came out and the AES code on the linux server came out. It's totally different. Although null pointer exception can not always be prompted, it must be that I request the api server according to the wrong AES code, and it certainly can't request the data.