4 Replies Latest reply: Oct 2, 2008 5:37 PM by Dieter Cailliau RSS

EJB3 Injection and HA-JNDI

Ben Dinnerville Newbie

Hi All,

When using EJB3, do you need to instruct the container to use ha-jndi to obtain / inject ha / clustered instances or does it do it automatically. If you do need to instruct the container to use ha-jndi / clustered instances (and hence, load balancing / fail over policies), how do you go about it? Is it annotation based or do you need to provide configuration some other way ?

What i am referring to is the use of either the @EJB or @Resource to inject session beans or JMX objects.

Cheers,

Ben

  • 1. Re: EJB3 Injection and HA-JNDI
    Richard Taylor Newbie

    I'm curious about this as well. So +1 from me.

  • 2. Re: EJB3 Injection and HA-JNDI
    Arbi Sookazian Master

    as far as cluster-enabling a Seam (EJB 3) app, all you need to do is the following:

    1) add to web.xml
    2) add @Clustered to your stateful session beans

    you can also configure your entity classes to be cached using Hibernate 2nd level cache.

    But as long as you do the two steps above, you don't need to worry.

    Keep in mind that if you're using mod_jk with IIS or httpd, make sure that sticky_sessions is enabled (this is a configuration that is highly recommended by JBoss). see Tomcat Connector info on JK.

  • 3. Re: EJB3 Injection and HA-JNDI
    Dieter Cailliau Newbie

    For MDB's deployed in the all folder you don't need to do anything: they find the destination and subscribe, whether it is remote or local; and when the coordinator-node dies, they resubscribe as soon as the new coordinator-node is ready hosting the destinations. So this makes me believe that the @Resource ConnectionFactory injection is cluster-aware somehow.

    For client side lookups you should use the right jndi parameters and port 1100 instead of 1099: this will make sure the client-side proxy finds a working node.

    For @EJB i dont think this would make sense since it meant for injecting local dependencies.

  • 4. Re: EJB3 Injection and HA-JNDI
    Dieter Cailliau Newbie

    Hm, correction about MDB: has nothing to do with @Resource, it's about @MessageDriven in the all-deployment.