Cluster to Cluster EJB Call
gwwallace Apr 25, 2012 3:52 PMFrom jaikiran pai
"https://docs.jboss.org/author/display/AS71/Clustered+EJBs once the initial node to connect to is known, the cluster topology will be sent back to the client. The client then auto-connects to the nodes within the cluster as and when appropriate. During auto connect, it requires certain configurations for the node (like security configurations) that have to be configured in the jboss-ejb-client.xml (if your client is a AS7 instance itself) or jboss-ejb-client.properties (for standalone clients).
The jboss-ejb-client.xml xsd is here and allows you to configure the cluster configurations either at each node level or for all nodes within a named cluster https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-ejb-client_1_1.xsd#L66
Here's an example of jboss-ejb-client.xml from a testsuite which shows an example https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/cluster/jboss-ejb-client.xml.
Feel free to ask if you have more questions around this. "
I've tried to configure the above but I'm stuck on the JBoss to JBoss configuration.
I've created the jboss-ejb-client.xml as follows
<jboss-ejb-client xmlns="urn:jboss:ejb-client:1.1">
<client-context>
<ejb-receivers>
<remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>
</ejb-receivers>
<clusters>
<cluster name="ejb" max-allowed-connected-nodes="20" cluster-node-selector="com.xxi.framework.jbossaux.cluster.RoundRobinClusterNodeSelector" connect-timeout="5000" security-realm="PasswordRealm">
<connection-creation-options>
<property name="org.xnio.Options.SSL_ENABLED" value="false"/>
<property name="org.xnio.Options.SASL_POLICY_NOANONYMOUS" value="true"/>
</connection-creation-options>
</cluster>
</clusters>
</client-context>
</jboss-ejb-client>
I know it gets picked up and read by JBoss - because if i put a dummy class name in for the cluster-node-selector it complains about ClassNotFound. (However i HAVE to put in a security-realm attribute and value otherwise the xml parsing code complains)
JBoss starts successfully. I can do the lookup to the remote EJB and I can make a remote method call.
However, the class specified in the cluster-node-selector value never gets instantiated and obviously never gets called either.
On startup the following messages are printed out from remoting
21:42:30,865 INFO [org.jboss.ejb.client.remoting.VersionReceiver] (Remoting "cmc5-104" task-4) Received server version 1 and marshalling strategies [river]
21:42:30,874 INFO [org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver] (MSC service thread 1-6) Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@148fc86f, receiver=Remoting connection EJB receiver [connection=Remoting connection <378fc5db>,channel=jboss.ejb,nodename=cmc5-101]} on channel Channel ID ef00ec9a (outbound) of Remoting connection 242d8a8c to cmc5-101.alpha.farecompare.com/192.168.12.161:4447
21:42:30,875 WARN [org.jboss.ejb.client.remoting.ChannelAssociation] (Remoting "cmc5-104" task-1) Unsupported message received with header 0xffffffff
It doesnt look like remoting is being told about the other node in the cluster - as if i run a standalone client i get
INFO: JBoss Remoting version 3.2.4.GA
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: Received server version 1 and marshalling strategies [river]
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@4ee993e, receiver=Remoting connection EJB receiver [connection=Remoting connection <cfed7c>,channel=jboss.ejb,nodename=cmc5-101]} on channel Channel ID d2dfe8e4 (outbound) of Remoting connection 35b4e829 to cmc5-101.alpha.farecompare.com/192.168.12.161:4447
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: Received server version 1 and marshalling strategies [river]
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@4ee993e, receiver=Remoting connection EJB receiver [connection=Remoting connection <23cb7f34>,channel=jboss.ejb,nodename=cmc5-102]} on channel Channel ID f2c475f8 (outbound) of Remoting connection 2aa49512 to cmc5-102.alpha.farecompare.com/192.168.12.162:4447
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
Apr 23, 2012 9:26:18 PM org.jboss.ejb.client.EJBClient <clinit>
INFO: JBoss EJB Client version 1.0.6.CR1
where it receives info on both nodes in the cluster.
Am i missing another piece of the configuration for the server to server call to get clustering to work or is this a bug ?