We are moving from single instance Glassfish server to multi instance glassfish server to achieve fail over and availability.
The setup i am trying to configure is like this
two glassfish server instances instance1, instance2 on two different Machines M1 and M2 form a cluster with name cluster1 .
Also two mq broker instances running each on M1 port 6770 and M2 port 6770, they form broker cluster.
The mq borker cluster is tied to glassfish app server , by configuring JMS service type to REMOTE and creating the JMS hosts respectively. I tested the JMS configuraton using ping , it was successful.
then created the ConnectionFactory "jms/TopicConnectionFactory" and Destination Resource "Jms/__TopicQueu" on target cluster1 .
Also i set the property addresslist = M1:6770,M2:6770 for "jms/TopicConnectionFactory" so that i can post the messages to the borker cluster using this connection factory.
The IIOP_LISTENER_PORT for the cluster1 is 33700.
I am trying to post messages to the broker-cluster using standalone java client . The client looks like this
public class SimpleTopicPublisher1 {
/**
* Main method.
*
* @param args the topic used by the example
*/
public static void main(String[] args) {
Context jndiContext = null;
TopicConnectionFactory topicConnectionFactory = null;
TopicConnection topicConnection = null;
TopicSession topicSession = null;
Topic topic = null;
TopicPublisher topicPublisher = null;
TextMessage message = null;
Properties props = new Properties();
props.setProperty( "java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty( "java.naming.factory.url.pkgs","com.sun.enterprise.naming");
props.setProperty( "java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty( "org.omg.CORBA.ORBInitialHost","M1");
props.setProperty( "org.omg.CORBA.ORBInitialPort","33700");
try {
jndiContext = new InitialContext(props);
topicConnectionFactory = (TopicConnectionFactory)
jndiContext.lookup("jms/TopicConnectionFactory");
topic = (Topic) jndiContext.lookup("jms/__TopicQueue");
topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topicPublisher = topicSession.createPublisher(topic);
message = topicSession.createTextMessage();
message.setText("Test Message");
topicConnection.start();
topicPublisher.send(message, DeliveryMode.PERSISTENT, 4, 0);
topicConnection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
I get the following exception :
javax.naming.NameNotFoundException: TopicConnectionFactory not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:80)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
Please suggest me what needs to be done here..To make it working..
[Message sent by forum member 'mavula8743' (m_k_avula_at_yahoo.com)]
http://forums.java.net/jive/thread.jspa?messageID=389693