TheMP
TheMP

Reputation: 8427

Glassfish - share EJB web application between nodes

I've got a glassfish server with a couple of EJB wars deployed on several different nodes. I want one of the applications (deployed on node1) to be 'visible' to all applications deployed on different nodes, so that they would be able to inject some remote beans from it. However, I am allowed to have only ONE instance of this application for the wole server, so deploying it separately on all nodes is not possible. Is this kind of setup possible in glassfish 3.1?

Upvotes: 3

Views: 256

Answers (1)

Deltharis
Deltharis

Reputation: 2373

This is achievable through deployment descriptors:

https://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#cross-appserverremoteref

In your sun-web.xml (or glassfish-web.xml, both will work in this case) define ejb-ref as follows:

<ejb-ref>
    <ejb-ref-name>fooejbref</ejb-ref-name>
    <jndi-name>corbaname:iiop:node_name:node_IIOP_port#foo.bar.YourEJBRemote</jndi-name>
</ejb-ref>

It's not exactly convenient - you will need to define that for each remote bean you need, and add such a descriptor in every app that needs it. It should however work, and I don't know of any better way.

Upvotes: 1

Related Questions