Re: Passing arguments to a spring boot main implementing command line runner to be called by pcf scheduler service


Daniel Mikusa
 

On Wed, Oct 25, 2017 at 7:24 PM, shruthi s <shruthi.sambasivan(a)gm.com>
wrote:

Thanks for helping me and also for the detailed explanation about the
extraction of jar while pushing an app. But i could not get the run-task
command to work. It errors out for Incorrect usage : unknown flag 'c'.
This is odd. It looks like there might be an escaping issue with the
command you're setting. It's hard to tell. I don't think this is related
to the `-cp` in the command. That's most definitely required or the JVM
won't be able to find the JarLauncher class.



I am using switch --no-start while i push the app. Is it required to be
started ?
That should be fine. I was running my demo this way yesterday.



I also tried
'cf run-task my_app_name
'$PWD/.java-buildpack/open_jdk_jre/bin/java $PWD/.org.springframework.boot.loader.JarLauncher
arg0 arg1'`. without the -cp.
Any chance you could send a screenshot of the command you're running so we
can see it exactly?


It seems to run but the does not actually call the main class rather
results in error :

2017-10-25T16:06:45.77-0700 [APP/TASK/my-task/0] OUT Creating container
2017-10-25T16:06:46.16-0700 [APP/TASK/my-task/0] OUT Successfully
created
container
2017-10-25T16:06:48.86-0700 [APP/TASK/my-task/0] ERR bash: -c: line 0:
une
xpected EOF while looking for matching `''
2017-10-25T16:06:48.86-0700 [APP/TASK/my-task/0] ERR bash: -c: line 1:
syn
tax error: unexpected end of file
2017-10-25T16:06:48.86-0700 [APP/TASK/my-task/0] OUT Exit status 1
2017-10-25T16:06:48.88-0700 [APP/TASK/my-task/0] OUT Destroying
container
2017-10-25T16:06:49.56-0700 [APP/TASK/my-task/0] OUT Successfully
destroye
d container

I have no clue what this error is.
I think it's a problem with how the command is being run. I think it runs
`bash -c 'blah'` where `blah` is the command to execute in the container.
That's why it almost seems like there's an escaping issue with the
command. Can you include the output of `cf tasks` for your app? That
should also list the command that was run.

Dan




Other thing, I am trying to create a job for my app which is bound to
scheduler service. when i execute the command to create job like :
cf create-job my_app my_job command

i get an error that no requested resource was found and i must create an
instance of scheduler service in this space inspite of having a service for
scheduler in the same space.

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.