we are developing a application that will find the application dependiecies in distributed environment. for that we are tracing the requests that are made to servlets and in turn which serlet calls which ejb. for that we are hacking into tomcat 5 and jboss's code, now we are not able to make out how to track which servlet called which ejb, as servlet call is just a method call, we can get the request parameters like servlet's name etc in jboss's any class.
can someone tell which what can be done regarding that.
How about this:
Use the Service Locator pattern to do you EJB lookup (a good idea in its own right), and pass an additional parameter: the calling class. You can then log caller + EJB being used. Of course, this means rewriting your servlet code.
If you want to do it without rewriting your servlet code, I have no idea how to accomplish this. It would probably involve some very ugly hacks of the JNDI service of Tomcat and JBoss, and you would risk breaking the server.