title: Spring boot app throws prematurely reached end of stream when executed with java -jar but works fine when executed as a service on RHEL
body: <p>I have created 2 applications using spring boot. The executable .JAR of app 1 is configured to run as a service on RHEL. This app 1 has basic CRUD calls to MongoDB. App 2 is a file processing application wherein it reads data from a file and update Mongo collections. Both the app uses same MongoDb instance which is configured as 3 node replica set.
  If app 2 is executed as a service on RHEL then it works all fine. But if app 2 is executed using java -jar command then it throws - 'prematurely reached end of stream' error while connecting to MongoDb. This is happening when app 1 is running in the background as a service. I have tried to execute app 2 with -jar with option &amp; to run it in the background but no luck. Also I have applied all the mnongo db uri parameters as per spring docs.</p>
  <p>Could you please help me to find out the difference in executing apps as a service and using java -jar and which the recommended approach ?</p>
  <p>Thanks</p>