问题
How to get the client IP address at the server-side when a EJB StatelessBean method is invoked through RMI/IIOP after a classical JNDI lookup ?
With JBoss 6.1 I tried the method java.rmi.server.RemoteServer#getClientHost
but it throws java.rmi.server.ServerNotActiveException: not in a remote call
. Is there any way to get the information ?
回答1:
Is it still embedded in the thread in JBoss 6.1?
String currentThreadName = Thread.currentThread().getName();
and then parse from there?
来源:https://stackoverflow.com/questions/10395165/how-to-get-client-ip-address-in-a-jboss-remote-ejb-call