I had to resort to using 'Procfile' + creating big fat jar with dependent jars inside. So the application worked but it crashes after a little while.
The application starts, makes a connection with a remote db server and goes in an infinite loop that sleeps for 5 seconds and sysout something. I did this to ensure app was running long enough for the 'cf push' process to show that 1 out of 1 instance running, 1 running, but that did not happen. The application runs, makes connection, goes inside the infinite loop and then crashes. Here are the logs:
2015-12-17T13:52:32.04+0530 [App/0] OUT Connection with server established... sleeping for 5 seconds...
2015-12-17T13:52:37.10+0530 [App/0] OUT Distributed Map size: 0
2015-12-17T13:52:37.10+0530 [App/0] OUT ***************** XXXXXXXXX ****************
2015-12-17T13:52:37.10+0530 [App/0] OUT Printing Environment variables...
2015-12-17T13:52:37.10+0530 [App/0] OUT {}Woke up... bye bye !!
2015-12-17T13:52:37.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:52:42.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:52:47.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:52:52.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:52:57.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:02.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:07.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:12.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:17.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:22.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:27.10+0530 [App/0] OUT In a loop. Waiting for 5 seconds....
2015-12-17T13:53:31.58+0530 [API/0] OUT App instance exited with guid bff76e66-3c91-4c9f-b38c-1cd384576156 payload: {"cc_partition"=>"default", "droplet"=>"bff76e66-3c91-4c9f-b38c-1cd384576156", "version"=>"6d1f4c31-96dd-4d13-b231-f0dc7306924c", "instance"=>"5e2fbac6edce472d98f9d7ba09d6e8dc", "index"=>0, "reason"=>"CRASHED", "exit_status"=>-1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1450340611}
2015-12-17T13:53:31.58+0530 [DEA/0] ERR Instance (index 0) failed to start accepting connections
2015-12-17T13:53:31.88+0530 [DEA/0] OUT Removing crash for app with id bff76e66-3c91-4c9f-b38c-1cd384576156
2015-12-17T13:53:31.88+0530 [DEA/0] OUT Stopping app instance (index 0) with guid bff76e66-3c91-4c9f-b38c-1cd384576156
The remote db is a Hazelcast server process. Logging that confirms connection is:
2015-12-17T13:55:11.67+0530 [App/0] ERR Dec 17, 2015 8:25:11 AM com.hazelcast.core.LifecycleService
2015-12-17T13:55:11.67+0530 [App/0] ERR INFO: HazelcastClient[hz.client_0_dev][3.5.4] is STARTING
2015-12-17T13:55:11.89+0530 [App/0] ERR Dec 17, 2015 8:25:11 AM com.hazelcast.core.LifecycleService
2015-12-17T13:55:11.89+0530 [App/0] ERR INFO: HazelcastClient[hz.client_0_dev][3.5.4] is STARTED
2015-12-17T13:55:12.01+0530 [App/0] ERR Dec 17, 2015 8:25:12 AM com.hazelcast.core.LifecycleService
2015-12-17T13:55:12.01+0530 [App/0] ERR INFO: HazelcastClient[hz.client_0_dev][3.5.4] is CLIENT_CONNECTED
2015-12-17T13:55:12.02+0530 [App/0] ERR Dec 17, 2015 8:25:12 AM com.hazelcast.client.spi.impl.ClientMembershipListener
2015-12-17T13:55:12.02+0530 [App/0] ERR INFO:
2015-12-17T13:55:12.02+0530 [App/0] ERR Members [1] {
2015-12-17T13:55:12.02+0530 [App/0] ERR Member [10.234.84.216]:5701
2015-12-17T13:55:12.02+0530 [App/0] ERR }
But strangely this also is considered as ERR by cloud foundry.
Attached is the output of CF_TRACE cf push.
Any idea what might be causing this?