HA-JNDI lookup of a JMS queue is ok on one node but fails o
schaffal Feb 11, 2005 12:54 PMHi,
For test purposes, I've to get knowledge on JBoss Clustering, fail-over, replication...
I've been turning around the following issue for some days now,
reading JBoss Clustering (Edition 7), Wiki, forum and bug reports. I
just hope it's something stupid I cannot pinpoint.
Setting : JBoss 4.0.1 ; 2 Linux servers (Suse) in the Cluster.
Beans are :
- HelloMDB : basic message driven bean listening on 'queue/hello'
- HelloServletJMS : servlet to send messages to 'queue/hello'
Note :
- both servers are multihomed
- Oracle is the common Database used (runs on Server1) ( deployed using ConfigJBossMQDB wiki page )
- use of DefaultPartition with default ports.
Server2 is started prior to Server1 (thus Server2 is the HA-JNDI server.)
Inside HelloServletJMS's, the code to send the message to HelloMDB (all try/catch and close removed):
InitialContext context = new InitialContext(); Queue queue = (Queue) context.lookup("queue/hello"); QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup("XAConnectionFactory"); QueueConnection queueConnection = queueFactory.createQueueConnection(); QueueSession queueSession = queueConnection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); QueueSender queueSender = queueSession.createSender(queue); TextMessage message = queueSession.createTextMessage(); message.setText(text); queueSender.send(message);
When doing an http request (from a third machine on another LAN) on HelloServletJMS :
on Server2 => OK : message treated by HelloMDB ( on Server1 or Server2 )
on Server1 => KO
Error on server1 is :
javax.naming.NameNotFoundException: queue not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:491) at org.jnp.server.NamingServer.getBinding(NamingServer.java:499) at org.jnp.server.NamingServer.getObject(NamingServer.java:505) at org.jnp.server.NamingServer.lookup(NamingServer.java:249) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520) at javax.naming.InitialContext.lookup(InitialContext.java:347) at hello.web.HelloServletJMS.doGet(HelloServletJMS.java:135) ...
META-INF/jboss.xml of the jar is ( message-driven part only ) :
<message-driven> <ejb-name>HelloMDB</ejb-name> <destination-jndi-name>queue/hello</destination-jndi-name> </message-driven>
/opt/jboss/server/all/deploy/jms/hajndi-jms-ds.xml (JMS part) :
<mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"> <attribute name="ProviderName">DefaultJMSProvider</attribute> <attribute name="ProviderAdapterClass"> org.jboss.jms.jndi.JNDIProviderAdapter </attribute> <!-- The combined connection factory --> <attribute name="FactoryRef">java:/XAConnectionFactory</attribute> <!-- The queue connection factory --> <attribute name="QueueFactoryRef">XAConnectionFactory</attribute> <!-- The topic factory --> <attribute name="TopicFactoryRef">XAConnectionFactory</attribute> <!-- Access JMS via HAJNDI --> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=[Local IP of Server2]:1100,[Local IP of Server1]:1100 </attribute> </mbean>
JGroup uses UDP ; from /opt/jboss/server/all/deploy/cluster-service.xml :
<UDP mcast_addr="228.1.2.3" mcast_port="45566" ip_ttl="32" ip_mcast="true" mcast_send_buf_size="800000" mcast_recv_buf_size="150000" ucast_send_buf_size="800000" ucast_recv_buf_size="150000" loopback="false" bind_addr="[LocalIP Due To Multi Homed Server]" />
Where local IP is correctly set to the ethernet card in use on the LAN.
Things verified :
- /etc/hosts :
"127.0.0.1 localhost" and local IPs are on 2 different lines.
- /etc/modules.conf (just in case since IPv6 is not used) :
"alias net-pf-10 off"
- multicast route is fine :
"netstat -nr | grep 224" gives the correct multicast route on both devices ( and on the correct ethernet card device )
224.0.0.0 0.0.0.0 240.0.0.0 U 40 0 0 eth0
- I do start with "-c all" and the --host=[LocalIP] options
I tried different combinations with "jnp://..." and "localhost:1100" for java.naming.provider.url ( even if loopbackIP:1100 was not opened )
I checked traffic on Server2:1100 . Port is used by Server1 at startup ( first in java.naming.provider.url ), but no traffic afterward ( neither on the autodiscovery port 1102 ).
I checked traffic on 230.1.2.3 : ok (heartbeat packets go through)
I checked traffic on autodiscovery multicast ip 230.0.0.4 : ok (membership packets go through)
If Server1 becomes HA-JNDI server, lookup on 'queue/hello' from Server1 are ok, not lookup from Server2. (only difference in config files is the bind_addr due to multi-homed servers)
What did I miss here ?
If more src/config files are needed to solve this, i'll be more than happy to send them.
Regards,
Alex