I want to have a bean Foo
in host A
which is injected, by the @EJB
annotation to a bean Bar
in host B
.
Both these hosts are separate stand-alone instances of Glassfish-v3
.
When reading the Glassfish
docs I found a lot of info, some of it sounded a bit contradicting.
I understood that every bean has a global jndi named assigned to it and understood how it is constructed, What is the syntax for portable global JNDI names?. I also understood that the the declaration of Foo
in Bar
should be something of this sort (assuming FooRemote
is the remote business interface of Foo
and fooejb
is the its module): @EJB(lookup=java:global/fooejb/FooRemote) FooRemote foo
, this is based on this.
What I can't understand is where I tell host A
and host B
to get to know each other.
I saw a lot of examples for application clients and application servers but I wasn't able to find an example for such a scenario.
In this question a sun-web.xml
and Global-JNDI
is mentioned but I think that it's not EJB3.1 (since it's not Portable JNDI
) and I don't understand where this sun-web.xml
should reside (I'd like to avoid it if I can).
It is mainly different in two ways:
- There is no -Dorg.omg.CORBA.ORBInitialHost= param option (as far as I can see)
- Any solution should of course allow the inclusion of a third host
C
which bothA
andB
communicate with for different purposes.
I have a strong feeling I'm missing something basic here and I'd really appreciate pointers to what I'm missing.
BTW, I'd like to avoid as much as possible from descriptor files and such and leave most info on annotations and only the host ip's to config in the server.
Edit:
I think another interesting aspect of this question is how load-balancing is used in this aspect, i.e. let's say I have A1
and A2
servers which are the same, how will load-balancing occur with respect to routing the request from B
to either A1
or A2
Edit2:
I think this might be unrelated to ejb 3.1 but related to the basis on how to enable two application servers to see each other's jndi registry. I think this is unrelated to ejb 3.1 as it seems a similar problem exists in the 3.0 with the Global
not portable jndi.
I would imagine some configuration in each app server would allow me to configure which other "neighbours" it should query for jndi remote beans.
Hope that gives a clue to someone out there.
Thanks,
Ittai