Hi,
I try to send a message from my spring based j2ee appilcation to Tibco - EMS 6x system.
J2ee application is deployed in Jboss 5x server.
But when I dpeloyed the application I found
exception - javax.naming.NameNotFoundException: Name not found: 'EHS_ResubmitQueue'
Tibco - EMS Queue configuration is attached
My Queue name is - EHS_ResubmitQueue
Tibco_ems_admin_screen.jpg
Spring configuration file as below.
<!-- JMS Sender Utility service configuration -->
<bean id="jmsSender" class="com.tibcoEMSConnect.JMSSenderUtilityService ">
<property name="jmsTemplate" ref="jmsTemplate" />
</bean>
<!-- ####################################### -->
<!-- JMS Spring Beans -->
<!-- ####################################### -->
<!-- JNDI Environment Template -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.tibco.tibjms .naming.TibjmsInitialContextFactory
</prop>
<prop key="java.naming.provider.url">tcp://vmesbdev.lnt.com:7222</prop>
<prop key="java.naming.factory.url.pkgs">com.tibco.tibjm s.naming</prop>
<prop key="java.naming.security.principal">admin</prop>
</props>
</property>
</bean>
<!-- JMS Queue Connection Factory -->
<bean id="internalJmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<!-- <value>XAConnectionFactory</value> -->
<value>QueueConnectionFactory</value>
</property>
</bean>
<!-- JMS Destination -->
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>EHS_ResubmitQueue</value>
</property>
</bean>
<!-- JMS Queue Template -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102 ">
<property name="connectionFactory" ref="internalJmsQueueConnectionFactory" />
<property name="defaultDestination" ref="destination" />
<property name="receiveTimeout" value="300" />
</bean>
But when I use simple java class I am able to connect and send the message with below code.
String serverUrl = "tcp://vmesbdev.lnt.com:7222";
// String userName = "admin";
// String password = "";
String queueName = "EHS_ResubmitQueue";
String data = "Test By Tintin";
public tibjmsQueueSender(String[] args) {
if (queueName == null) {
System.err.println("Error: must specify queue name");
}
System.err.println("Publishing into queue: '" + queueName + "'\n");
try {
QueueConnectionFactory factory = new com.tibco.tibjms.TibjmsQueueConnectionFactory(serv erUrl);
// QueueConnection connection =
// factory.createQueueConnection(userName, password);
QueueConnection connection = factory.createQueueConnection();
QueueSession session = connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
javax.jms.Queue queue = session.createQueue(queueName);
QueueSender sender = session.createSender(queue);
/* publish messages */
javax.jms.TextMessage message = session.createTextMessage();
String text = data;
message.setText(text);
sender.send(message);
System.err.println("Sent message: " + text);
connection.close();
} catch (JMSException e) {
e.printStackTrace();
System.exit(0);
}
}