<p>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?</p>

<p>I am using:</p>

<ul>
<li>Server: springcloud/spring-cloud-dataflow-server:2.0.2.RELEASE</li>
<li>Skipper: springcloud/spring-cloud-skipper-server:2.0.1.RELEASE</li>
<li>MySQL: mysql:5.6</li>
<li>Kafka: wurstmeister/kafka:2.11-0.11.0.3</li>
</ul>

<p>I am able to run task manually using curl or UI.</p>

<p>Task definition is timestamp: uri=docker:springcloudtask/timestamp-task:2.1.0.RC1</p>

<p>I have connected to pod and tried to create scheduler using REST API (same result with UI):</p>

<pre><code>curl -vL 'http://localhost:80/tasks/schedules' -i -X POST -d 'scheduleName=myschedule&amp;taskDefinitionName=test&amp;properties=scheduler.cron.expression%3D00+22+17+%3F+*'
</code></pre>

<p>And received response:</p>

<pre><code>*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
&gt; POST /tasks/schedules HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.58.0
&gt; Accept: */*
&gt; Content-Length: 101
&gt; Content-Type: application/x-www-form-urlencoded
&gt;
* upload completely sent off: 101 out of 101 bytes
&lt; HTTP/1.1 500
HTTP/1.1 500
&lt; Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
&lt; Transfer-Encoding: chunked
Transfer-Encoding: chunked
&lt; Date: Tue, 16 Apr 2019 09:45:21 GMT
Date: Tue, 16 Apr 2019 09:45:21 GMT
&lt; Connection: close
Connection: close

&lt;
* Closing connection 0
[{"logref":"NullPointerException","message":"NullPointerException"}]
</code></pre>

<p>Server shows error log:</p>

<pre><code>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)
</code></pre>

<p>Has anybody experienced such problem?</p>

Darius S.
<p>I attempted to try a similar use-case with the out-of-the-box <code>timestamp</code> task application, and I notice everything working as expected.</p>

<p><strong>Task Definition:</strong></p>

<blockquote>
  <p>dataflow:>task create schtask --definition "timestamp"</p>
</blockquote>

<p><strong>Schedule via Dashboard:</strong></p>

<p><a href="https://i.stack.imgur.com/7QC2f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7QC2f.png" alt="enter image description here"></a></p>

<p><strong>Schedule via Cron:</strong></p>

<blockquote>
  <p>curl '<a href="http://localhost:80/tasks/schedules" rel="nofollow noreferrer">http://localhost:80/tasks/schedules</a>' -i -X POST \
      -d 'scheduleName=sabby-sch2&amp;taskDefinitionName=schtask&amp;properties=scheduler.cron.expression%3D*%2F1%20*%20*%20*%20*&amp;arguments=--foo%3Dbar'</p>
</blockquote>

<p><strong>CronJobs</strong></p>

<pre><code>&gt; 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
</code></pre>

<p><strong>Results</strong></p>

<pre><code>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
</code></pre>

<p>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?</p>
