0

I'm trying to deploy a test java program on mesos cluster using marathon. I've created a tar ball with all required jars and config files. The tar also has a cmd.sh that launches the app. Cmd.sh snippet

chmod a+rx *.jar
java -ea -Dlog4j.configuration="file:./log4j.prod.properties" -cp my-app-0.1-SNAPSHOT.jar:lib/* package.name.main.class.name

This tar is provided as an URI. I can see in log file that tar is downloaded and unpacked correctly. But execution fails with error

I0331 23:00:35.135365 30558 exec.cpp:134] Version: 0.27.1
I0331 23:00:35.137852 30588 exec.cpp:208] Executor registered on slave 11aaafce-f12f-4aa8-9e5c-200b2a657225-S1
./cmd.sh: line 5: java: command not found

Any idea why its not finding java? I'm not using any custom container. Only parameters I've set are id, cpu, mem, instance, uri and cmd=cmd.sh

Is this the recommended way to run java apps? My java program is stateless(uses zookeeper for state) and I intend to run several instance of this app. Please feel free to suggest alternate ways of launching or deploying such an app.

Cheeko
  • 1,193
  • 1
  • 12
  • 23
  • why don't you type the full path to java? – user2260040 Mar 31 '16 at 23:24
  • I could but I'd like to understand what is happening and get feedback on the general approach. BTW, on the same slave node I'm able to scp the tarball and run my app with sh -c cmd.sh. – Cheeko Apr 01 '16 at 02:27
  • 1
    check the path when you run sh -c vs running the from tar. – user2260040 Apr 03 '16 at 21:51
  • @user2260040 Please put this down as an answer so that I can accept it. This does help me move on. Thanks. I'd still like to understand if there is a better way to start java apps in Marathon. – Cheeko Apr 05 '16 at 00:55
  • I have added the answer. I haven't used java in a long (apart from Android development), so don't think I can help with Marathon. – user2260040 Apr 05 '16 at 03:50

1 Answers1

0

Please check the path when you run sh -c vs running the from tar.

user2260040
  • 1,275
  • 1
  • 13
  • 26