I am working on a distributed application and getting an exception in the main method of a class. How do I know which java program has invoked it ? I tried debugging the distributed application, but could not figure it out.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot know what invoked the java process from ClassB. The Exception will only go as deep as it’s own call stack from it’s process. If something else started the process, even if it was java itself, there is no way of know this from ClassB.
You are better off using helpful logging (of both debug/info messages and exception stacktraces) from ClassA. You will have to make sure that ClassB exits appropriately when it fails (exit with a code other than 0) and then ClassA can see this failure in the process it spawned.