members do not form a cluster
===

I have to create a cluster with a single receiver and several senders on a WAN.
The problem is that after calling JChannel.connect() with the same clustername in each member there's no common cluster with common view created but each component sees its own.
The result is that when sending messages to receiver the latter's physical address cannot be determined and all messages are dopped.

The sender :

    package mydemo;

    import org.jgroups.Address;
    import org.jgroups.JChannel;
    import org.jgroups.ReceiverAdapter;

    public class Sender {
	JChannel channel;
	Address receiver;
	String group;
	String props;
	String name;
	
	public Sender(Address rcv, String group, String props, String name) {
		receiver = rcv;
		this.group = group;
		this.props = props;
		this.name = name;
		try {
			channel = new JChannel(props);
			//channel.setName(group);
			channel.connect(group);
			System.out.println("View size(sender): " + channel.getView().getMembers().size());
			System.out.println("Sender address: " + channel.getView().getMembers().get(0));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void sendMessage() throws Exception {
		channel.send(receiver,"Hello, I am "+name);
	}
	
	public void setReceiverAdapter(ReceiverAdapter adapter) {
		channel.setReceiver(adapter);
	}

    }

The receiver:

    package mydemo;

    import java.util.LinkedList;
    import java.util.List;

    import org.jgroups.JChannel;
    import org.jgroups.Message;
    import org.jgroups.ReceiverAdapter;
    import org.jgroups.View;

    public class ClusterTest extends ReceiverAdapter {
	JChannel channel;
	List<Sender> senders;

	public ClusterTest(int num, String props, String name)
			throws Exception {
		senders = new LinkedList<Sender>();
		channel = new JChannel(props);
		channel.setReceiver(this);
		//channel.setName(name);
		channel.connect(name);
		System.out.println("Rcv address: " + channel.getView().getMembers().get(0));
		for (int i = 0; i < num; i++) {
    /*			senders.add(new Sender(channel.getView().getMembers().get(0), name,
					props, "Sender" + i));*/
			senders.add(new Sender(channel.getAddress(), name,
					props, "Sender" + i));
			senders.get(i).setReceiverAdapter(this);
			System.out.println("View size(rcv): " + channel.getView().getMembers().size());
		}
	}

	public void receive(Message msg) {
		System.out.println("received message " + msg);
	}

	public void viewAccepted(View view) {
		System.out.println("received view " + view.toString());
	}
	
	public void start() throws Exception {
		for (Sender sender : senders) {
			Thread.sleep(3000);
			sender.sendMessage();
		}
		channel.close();
	}

	public static void main(String[] args) throws Exception {
		new ClusterTest(3, "d:/sth/MyDemo/src/conf/tcp.xml", "TestGroup").start();
	}
    }

The tcp.xml provided by jgroups was used with small changes in TCPPING:

    <TCPPING timeout="3000"
             initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800],localhost[7801],localhost[7802],
             	localhost[7803],localhost[7804],localhost[7805],localhost[7806],localhost[7807],localhost[7808],
             	localhost[7809],localhost[7810],localhost[7811],localhost[7812],localhost[7813],localhost[7814],
             	localhost[7815],localhost[7816]}"
             port_range="10"
             num_initial_members="11"/>

Output:



GMS: address=hu3cb9kc-42336, cluster=TestGroup, physical address=10.93.25.142:7806

received view [hu3cb9kc-42336|0] [hu3cb9kc-42336]

Rcv address: hu3cb9kc-42336


GMS: address=hu3cb9kc-48774, cluster=TestGroup, physical address=10.93.25.142:7807

View size(sender): 1

Sender address: hu3cb9kc-48774

View size(rcv): 1


GMS: address=hu3cb9kc-38597, cluster=TestGroup, physical address=10.93.25.142:7808

View size(sender): 1

Sender address: hu3cb9kc-38597

View size(rcv): 1


GMS: address=hu3cb9kc-55548, cluster=TestGroup, physical address=10.93.25.142:7809

View size(sender): 1

Sender address: hu3cb9kc-55548

View size(rcv): 1

WARNING: hu3cb9kc-48774: no physical address for hu3cb9kc-42336, dropping message

WARNING: hu3cb9kc-48774: no physical address for hu3cb9kc-42336, dropping message

WARNING: hu3cb9kc-38597: no physical address for hu3cb9kc-42336, dropping message

WARNING: hu3cb9kc-38597: no physical address for hu3cb9kc-42336, dropping message

WARNING: hu3cb9kc-48774: no physical address for hu3cb9kc-42336, dropping message

...

Could you please help me? Maybe the concept is wrong but as the target is working on WAN I have to use unicast and TCP.

Thanks,
Katalin