简体   繁体   中英

How to get the address of the calling remote client of an EJB method in JBoss AS7

i have a distributed application that consists of one server, the JBoss AS7 on which the frontend and the backend of the application run. Several clients, running on other machines in a network obtain the JNDI initial context of the JBoss to get certain objects. Each client is unique and needs to be identified without doing any configuration on them. My approach is to get their address and map the data related to them (pool of stuff, evenly mapped between all connected clients).

How can i obtain the IP address of the calling client of an EJB method?

I already found 'hacks' that describe how to get the information out of the thread name (used for example in JBoss 4.x), but that always returns something like:

EJB default - 7

See How can you get the calling ip address on an ejb call?

If you provide a code snippet or a method call on some context, can you please add the source of it? I was unable to find something by searching for EJB3 , Remoting3 and similar stuff

Just an idea,

May be use can expose your ejb through a rest based web service layer. If you do so it is easy to find remote host name and may also use filter servlet to allow or disallow a request.

You can use @EJB to inject your bean into rest class assuming you will use JAX-RS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM