1 2 Previous Next 16 Replies Latest reply on Jan 21, 2011 3:14 AM by fsotest Go to original post
      • 15. Re: stateful session beans and clustering
        thunder.farmer

        Fin Steenbjerg 编写:

         

        Hi Thunder Lei. I guess what you are  taking about here is clustering of remote EJBs and looking up proxies via HA-JNDI. My case, is not quite that. My stateful ejb is a local bean accessed from a servlet within the same application via normal JNDI or via simple injection. The clustering in this case comes down to session replication of the bean state. Later on, I have to test HA-JNDI for access service made available via remote EJBs. If I am not correct please correct me.

        Yes, you are right. They are different cases.

        But when I look at your comments for the second time, I recall the section "Chapter 5. Clustered JNDI Services" in the document "cluster_guide". It reads "On the server side, a naming Context obtained via a call to new InitialContext() will be bound to the local-only, non-cluster-wide JNDI Context. So, all EJB homes and such will not be bound to the cluster-wide JNDI Context, but rather, each home will be bound into the local JNDI."

        So the EJB proxy you get in the servlet actually is normal local EJB reference, which has NO any cluster features.

        The Servlet and the EJB you get are running the same node. when the node is down, the EJB instance is gone and has no chance of failover.

        When thinking it over, the tow cases do have something in common, that is, the server running the EJB instance is down.

        Moreover if you want to get a clustered EJB proxy I think you need to user HA-JNDI on the server side. pls refer to the section "5.2.1. For clients running inside the application server"

         

        Also your comments bring up another thought, is it correct or possible to keep a Local proxy in the session to achieve failover?

        When one node is down, your request goes to another node, which is in different JVM where the Local proxy got from another JVM porbably doesn't work.

        So if you want to achieve failover in your case, I think you need to do some extra work,

        1. using HA-JNDI

        2. lookup the EJB for every request and NOT keep the EJB reference in the session.

        All these are beyond my knowledge, I just think of that, and put there for you reference.

        We need experts from JBoss on this.......

        It's little interesting. If I get time, I will do some research on this, ~

        • 16. Re: stateful session beans and clustering
          fsotest

          Actually the way Nicklas suggested which included using @inject to inject an local stateful object is exactly what I want. This is nice seen from the developers point of view. It is simple and okay intuitive. I just hope Paul Ferraro makes something out of the stacktrace I posted to him.

          I don't want to include any clustered ejbs by using HA-JNDI. Actually the only case where HA-JNDI will be usable for me is when I have a client that needs to access an remote stateful ejb. That's how I see it but I don't have any experience with it - so it would be nice if some one cleared this out for us. 

          1 2 Previous Next