users@glassfish.java.net

Re: problem with running ejb client

From: <glassfish_at_javadesktop.org>
Date: Sat, 17 Jan 2009 05:58:47 PST

First, when you use multiple endpoints it's generally because you have multiple instances in a cluster. The idea is that the client is willing to connect to any of the endpoints in the cluster because they are all configured the same with the same applications. That is, the client will receive equivalent service from any of the hosts in the cluster.

The situation you described is a bit different, with a cluster and a separate instance. There is no guarantee that the separate instance will have the same apps - and same JNDI names, for example - as the cluster hosts. I don't think it's an "illegal" set-up, just very unusual and probably not what you want (for the following reason).

The endpoints list is used for "bootstrapping" into the cluster ORBs. That is, the client-side ORB uses the endpoint list you define to connect to ONLY one of the endpoints in the list. Once it can connect to one of those ORBs, that server-side ORB will tell the client ORB about all the active ORBs in the cluster. So, suppose your cluster includes instances 1, 2, and 3 but your endpoint list includes only 1 and 2. If 1 or 2 (or both) are running when your client starts and first tries to contact a server ORB, then your client will be able to fail over to 1, 2, OR 3. Even better, suppose your client is running as cluster members leave and enter the cluster as you restart instances. The client ORB will always know which server ORB(s) are available and will not try to fail over to an absent instance, EVEN IF that instance was listed
in the original endpoint list.

Second, as for the port assignments. You should be able to configure different ports for the different instances in the cluster. Just be sure you are adjusting the configs for the instances in the cluster as opposed to the config for the cluster as a whole. (It has been a while since I did this and I don't have the admin console open in front of me.)

Third, you have listed only two endpoints for the client to use. Yet there are really three: instance1, instanc2, and instance. The client cannot really connect to a cluster - it can connect to an instance in the cluster (or, in your case, alternatively to the other separate instance). That probably explains why your client fails when the cluster is down but the separate instance is up - you have not told the client the endpoint to use for the stand-alone instance.

In summary: Normally, you'll want to list only cluster members in the endpoint list for the client to use for bootstrapping. And you should be able to configure different port numbers for instance1 and instance2 as long as you adjust the instance-level config, not the cluster-level config.

Hope that helps.

- Tim
[Message sent by forum member 'tjquinn' (tjquinn)]

http://forums.java.net/jive/thread.jspa?messageID=326624