0
votes

I have a cloud foundry application which has shell exec(builder) through which i can execute shell scripts.

My cf application first downloads the shell script and java jar to CF local (ex:/app/lib/) directory from s3 and it executes the shell script.In shell script i am triggering a java program and it fails with "Shell command returned a non-zero exit value: 127 error" .

cat my_shell_java.sh -> 
#!/bin/bash 
java -jar myjar.jar com.abc.def.myClass

i have tried with below command as well but same error.

cat my_shell_java.sh -> 
#!/bin/bash 
$JAVA_HOME/bin/java java -jar myjar.jar com.abc.def.myClass 

But if i execute shell which creates a folder in CF , it works fine.

cat my_shell_mkdir.sh ->
#!/bin/bash 
mkdir /app/lib

Can some one pls help me on how can i execute a java program from shell script in Cloud foundry.

1
I have resolved this by locating java buildpack for my app ex: /app/.java-buildpack/oracle_jre/bin/java -jar myjar.jar com.abc.def.myClass and it worked. - vpopuri

1 Answers

0
votes

You can just push the java app archive using cf push. What is the need for the shell script? I am just curious....