Author |
Message
|
mds1985 |
Posted: Mon Jun 20, 2016 8:57 am Post subject: JMSOutput node is not publishing the messages to topic |
|
|
Newbie
Joined: 20 Jun 2016 Posts: 4
|
Hello,
I am using the JMSOutput node for the first time. I did some research around it before using.
The issue that I am currently facing is not being able to publish the message to a topic on the remote server. If I use the plain java class to do the same thing using the same binding file, it works and I am able to publish the message but with the JMSoutput node it is not working.
Since we could not get the right seebeyond .jar file which has com.stc.is.naming.NamingContextFactory class in it we thought of using the stcjms.jar which is available with us.
We are using a java class to create the .binding file with the WMQ initial context factory com.sun.jndi.fscontext.RefFSContextFactory
Below are the configurations I am using:
Broker Version: 8.0.0.2
OS : AIX
JMS Provider : Seebeyond
.jar file : stcjms.jar
Properties on JMSOutput Node:
JMSProvider Name : Seebeyond
Initial Context factory: com.sun.jndi.fscontext.RefFSContextFactory
Location JNDI bindings: file:|||wmb|QMGR|logs| ("/" are replaced by "|")
Publication Topic : etOrder
I have placed all the MQ, Seebeyond and JMS related jars in the shared-classes directory of the broker
/var/mqsi/config/QMGR/shared-classes/
/var/mqsi/shared-classes
the .jar list is as below:
com.ibm.mq.headers.jar
com.ibm.mq.jms.Nojndi.jar
dhbcore.jar
javax.jms.jar
jta.jar
stcjms.jar
com.ibm.mq.jar
com.ibm.mqjms.jar
fscontext.jar
jms.jar
providerutil.jar
com.ibm.mq.jmqi.jar
connector.jar
j2ee.jar
jndi.jar
stcjcs.jar
I tailed the stderr log which says:
2016-06-20 15:47:29.220 85 java.lang.ClassCastException: javax.naming.Reference incompatible with javax.jms.Destination
2016-06-20 15:47:29.220 85 at com.ibm.broker.jmsclienthelper.JMSClientHelper.lookUpJMSDestinations(JMSClientHelper.java:3223)
2016-06-20 15:47:29.220 85 at com.ibm.broker.jmsclienthelper.JMSClientRequestResponseHelper.setupJMSRequest(JMSClientRequestResponseHelper.java:939)
2016-06-20 15:47:29.220 85 at com.ibm.broker.jmsclientnodes.JMSClientOutputNode.evaluate(JMSClientOutputNode.java:436)
2016-06-20 15:47:29.220 85 at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1480)
2016-06-20 16:45:12.969 85 java.lang.ClassCastException: javax.naming.Reference incompatible with javax.jms.Destination
2016-06-20 16:45:12.969 85 at com.ibm.broker.jmsclienthelper.JMSClientHelper.lookUpJMSDestinations(JMSClientHelper.java:3223)
2016-06-20 16:45:12.969 85 at com.ibm.broker.jmsclienthelper.JMSClientRequestResponseHelper.setupJMSRequest(JMSClientRequestResponseHelper.java:939)
2016-06-20 16:45:12.969 85 at com.ibm.broker.jmsclientnodes.JMSClientOutputNode.evaluate(JMSClientOutputNode.java:436)
2016-06-20 16:45:12.969 85 at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1480)
And the WMB exceptionlist says:
<CausedBy>
<failingComponent>/{JMSClientErrors:handleJNDIException()}</failingComponent>
<componentFaultCode>RecoverableException.4640</componentFaultCode>
<faultDiagnostic>Failure to obtain JNDI administered objects - 1:[[Broker 'QMGR'; Execution Group 'AEI'; Message Flow 'XOrderDesc'; Node 'JMS Output::ComIbmJMSClientOutputNode' ]]; 2:[[com.stc.is.naming.NamingContextFactory]]; 3:[[file:///wmb/QMGR/logs]]; 4:[[connection]]; 5:[[]]; 6:[[Failed to create InitialContext using factory specified in hashtable]]; 7:[[ Failed to create InitialContext using factory specified in hashtable]]</faultDiagnostic>
<faultSeverity>3</faultSeverity>
</CausedBy>
can you please help me figuring out where I am making mistake? or am I missing some steps setting up the JMSouput node? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 20, 2016 9:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The question is really about the content of your JMS bindings file.
SeeBeyond as a provider may not use it.
Your error says that the information is incompatible with the provider's destination... i.e. expecting an MQ Publish in a SeeBeyond provider???
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mds1985 |
Posted: Tue Jun 21, 2016 12:57 am Post subject: |
|
|
Newbie
Joined: 20 Jun 2016 Posts: 4
|
Thank you. You are right. Actually when I said the plain java class can publish the message using the same .binding file by casting the Seebeyond objects to MQ objects.
Can't we do the same using the JMS output node. Also is there a specific format for seebeyond .binding file which I can edit with host/port and topic information so that JMS output node can use it. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 21, 2016 4:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The JMSOutput node doesn't talk to MQ.
It talks directly to whatever JMS Provider you've configured it to talk to.
If you happen to choose to use the MQ JMS Provider, then it will talk to MQ - but over JMS instead of any kind of native MQ.
Not at all clear what your standalone client code is doing. Even less clear why it's doing that. Is it trying to act as a bridge between MQ and Seebeyond? IIB can certainly do that, using JMSInput/Output nodes and MQInput/Output nodes. But you would do all of your work with the IIB message trees, and not by casting any objects to any other objects. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
mds1985 |
Posted: Tue Jun 21, 2016 5:09 am Post subject: |
|
|
Newbie
Joined: 20 Jun 2016 Posts: 4
|
Sorry for any confusion. Actually my standalone java code is called by the compute node in the message flow. I am not using the JMSOutput node in this case.
This standalone Java class is casting the intialcontext object with STC(seebeyond) classes. The below code works and publishes the message to the remote server.
public class EtXOrderPublish {
public static String publishToTopic(String requestData, String ContextFactory, String ProviderURL) {
// Declare variables
String result = null;
// Initialise methods
// Create string builder to log the steps of process
StringBuilder log = new StringBuilder();
STCTopic topic = new STCTopic();
try {
// Setup JNDI
Properties props = new Properties();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
ContextFactory);
props.put(InitialContext.PROVIDER_URL, ProviderURL);
InitialContext ctx = new InitialContext(props);
// Find connection factory
STCTopicConnectionFactory fact = (STCTopicConnectionFactory) ctx
.lookup("connection");
log.append(ctx.lookup("connection").toString() +"\n");
// Topic destination
topic = (STCTopic) ctx.lookup("APTopic");
log.append("TopicName: " + topic +"\n");
// Create connection, session
STCTopicConnection conn = (STCTopicConnection) fact
.createTopicConnection();
// Start connection
conn.start();
log.append(conn +"\n");
STCTopicSession session = (STCTopicSession) conn
.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
log.append(session+"\n");
result = "Session Created" + topic.toString()+"\n" +log.toString();
// Send message
STCTopicPublisher producer = (STCTopicPublisher) session
.createPublisher(topic);
TextMessage msgText = session.createTextMessage(requestData);
producer.publish(msgText, DeliveryMode.NON_PERSISTENT,
Message.DEFAULT_DELIVERY_MODE, 0);
log.append("Message: " + requestData +"\n");
// Close connection
conn.close();
result = "Message published suc" +
"cessfully to topic "+ topic.toString()+"\n" +log.toString();
} catch (Exception ex) {
result = "ExceptionInPublishing message to topic "+
topic.toString()+"\n"+ log.toString()+"\n"+ex.getMessage();
}
//Return result
return result;
}
}
But if I want to use the JMSOutput node to do the same thing instead of using the java class, it is not working and the error is as below,
Node 'JMS Output::ComIbmJMSClientOutputNode' ]]; 2:[[com.sun.jndi.fscontext.RefFSContextFactory]]; 3:[[file:///wmbdata/QMGR1/logs/]]; 4:[[connection]]; 5:[[]]; 6:[[javax.naming.Reference incompatible with javax.jms.Destination]]; 7:[[ java.lang.ClassCastException : javax.naming.Reference incompatible with javax.jms.Destination]]</faultDiagnostic> |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 21, 2016 5:13 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So what's your bindings file look like? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
mds1985 |
Posted: Tue Jun 21, 2016 6:16 am Post subject: |
|
|
Newbie
Joined: 20 Jun 2016 Posts: 4
|
#This file is used by the JNDI FSContext.
#Tue Jun 21 15:02:26 BST 2016
APTopic/ClassName=com.seebeyond.jms.client.STCTopic
connection/ClassName=com.seebeyond.jms.client.STCTopicConnectionFactory
APTopic/RefAddr/0/Encoding=Base64
connection/RefAddr/0/Encoding=Base64
APTopic/FactoryName=com.seebeyond.jms.client.STCTopic
connection/RefAddr/0/Content=rO0ABXQADTE3Mi4xNi4xNC4xMzV3BAAAX4l0ACtjb20uc2VlYmV5b25kLmptcy5zb2NrZXRzLlNv\r\nY2tldFByb3RvY29sTWdycHcEAAAAZHA\=\r\n
APTopic/RefAddr/0/Type=STCDestination
connection/RefAddr/0/Type=STCConnectionFactory
APTopic/RefAddr/0/Content=rO0ABXNyACFjb20uc2VlYmV5b25kLmptcy5jbGllbnQuU1RDVG9waWPq+P3bksFZLgIAAHhyACdj\r\nb20uc2VlYmV5b25kLmptcy5jbGllbnQuU1RDRGVzdGluYXRpb27D7HASHDMuMAIAAloAEW1FeGlz\r\ndGluZ1RlbXBEZXN0TAAFbU5hbWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cAB0AAhldFhPcmRlcg\=\=\r\n
connection/FactoryName=com.seebeyond.jms.client.STCTopicConnectionFactory
I have added the .jar file paths to the CLASSPATH and now I am not getting the above error but seeing
<faultDiagnostic>Failure to obtain JMS Connection javax/jms/ConnectionFactory.createConnection()Ljavax/jms/Connection; - 1:[[Broker 'QMGR1'; Execution Group 'AI'; Message Flow 'XOrderDesc'; Node 'JMS Output::ComIbmJMSClientOutputNode' ]]; 2:[[com.sun.jndi.fscontext.RefFSContextFactory]]; 3:[[ javax/jms/ConnectionFactory.createConnection()Ljavax/jms/Connection;]]</faultDiagnostic> |
|
Back to top |
|
 |
|