I have a Java Class which does JNDI lookup and returns lookup ejb object. And if there is failure in lookup various exceptions are handled, when there is failure it will return null.
Now when that API is called and lookup fails we will get nullpointer exception. We can do a null check in calling class but I need exact reason for failure .. How to catch those exceptions thrown in base class?