I'm setting up SCDF on kubernetes and i want to run scheduled task's but i am receiving NullPointerException, has anybody experienced such problem?
I am using:
I am able to run task manually using curl or UI.
Task definition is timestamp: uri=docker:springcloudtask/timestamp-task:2.1.0.RC1
I have connected to pod and tried to create scheduler using REST API (same result with UI):
curl -vL 'http://localhost:80/tasks/schedules' -i -X POST -d 'scheduleName=myschedule&taskDefinitionName=test&properties=scheduler.cron.expression%3D00+22+17+%3F+*'
And received response:
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST /tasks/schedules HTTP/1.1
> Host: localhost
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Length: 101
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 101 out of 101 bytes
< HTTP/1.1 500
HTTP/1.1 500
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Tue, 16 Apr 2019 09:45:21 GMT
Date: Tue, 16 Apr 2019 09:45:21 GMT
< Connection: close
Connection: close
<
* Closing connection 0
[{"logref":"NullPointerException","message":"NullPointerException"}]
Server shows error log:
2019-04-16 09:45:21.856 DEBUG 1 --- [p-nio-80-exec-9] o.hibernate.internal.util.EntityPrinter : org.springframework.cloud.dataflow.core.AppRegistration{objectVersion=0, name=timestamp, id=159, type=task, uri=docker:springcloudtask/timestamp-task:2.1.0.RC1, version=2.1.0.RC1, defaultVersion=true, metadataUri=maven://org.springframework.cloud.task.app:timestamp-task:jar:metadata:2.1.0.RC1}
2019-04-16 09:45:21.856 DEBUG 1 --- [p-nio-80-exec-9] o.hibernate.internal.util.EntityPrinter : org.springframework.cloud.dataflow.core.TaskDefinition{taskName=test, dslText=timestamp}
2019-04-16 09:45:21.857 DEBUG 1 --- [p-nio-80-exec-9] o.s.orm.jpa.JpaTransactionManager : Not closing pre-bound JPA EntityManager after transaction
2019-04-16 09:45:21.880 ERROR 1 --- [p-nio-80-exec-9] o.s.c.d.s.c.RestControllerAdvice : Caught exception while handling a request
java.lang.NullPointerException: null
at org.springframework.cloud.scheduler.spi.kubernetes.KubernetesScheduler.getExceptionMessageForField(KubernetesScheduler.java:149)
at org.springframework.cloud.scheduler.spi.kubernetes.KubernetesScheduler.schedule(KubernetesScheduler.java:73)
at org.springframework.cloud.dataflow.server.service.impl.DefaultSchedulerService.schedule(DefaultSchedulerService.java:151)
at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController.save(TaskSchedulerController.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Has anybody experienced such problem?
I attempted to try a similar use-case with the out-of-the-box timestamp
task application, and I notice everything working as expected.
Task Definition:
dataflow:>task create schtask --definition "timestamp"
Schedule via Dashboard:
Schedule via Cron:
curl 'http://localhost:80/tasks/schedules' -i -X POST \ -d 'scheduleName=sabby-sch2&taskDefinitionName=schtask&properties=scheduler.cron.expression%3D*%2F1%20*%20*%20*%20*&arguments=--foo%3Dbar'
CronJobs
> k get cronjob
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
cronjob.batch/sabby-sch1 */1 * * * * False 1 19s 103s
cronjob.batch/sabby-sch2 */1 * * * * False 1 19s 75s
Results
NAME READY STATUS RESTARTS AGE
pod/mysql-f5986679b-ftlz2 1/1 Running 0 21h
pod/rabbitmq-7489f8c586-8xq6x 1/1 Running 0 21h
pod/sabby-sch1-1555432020-rwwcf 0/1 Completed 0 70s
pod/sabby-sch1-1555432080-6wcjb 0/1 Completed 0 10s
pod/sabby-sch2-1555432080-k2pwm 0/1 Completed 0 10s
pod/scdf-server-77b6dbc46c-d9f57 1/1 Running 0 21h
pod/skipper-7ccbbf95dd-94l5j 1/1 Running 0 21h
Maybe there's something to the cron-expression in use. Perhaps you could repeat the same cron-expression from my example to verify it on your end?