ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » sub.receive() not getting message from sub queue

Post new topic  Reply to topic
 sub.receive() not getting message from sub queue « View previous topic :: View next topic » 
Author Message
hanu
PostPosted: Thu Jun 12, 2003 10:37 pm    Post subject: sub.receive() not getting message from sub queue Reply with quote

Newbie

Joined: 12 Jun 2003
Posts: 1

HI

I am running pub/sub in client mode .
I am getting nullpointer exception when i tried receiving message by
using sub.receive(1000) and applicatiog is showing 10054(X'2746')
MQservr is runing on different machine .Websphere is installed on the
same machine.
We may be missing small configuration somewhere .
PLease have a looka t it and pass ur valuable comments and
suggestions.

Scenario.

I am giving the scenario below so that problem can be traced easily.

I am using JMS to connect to MQ and trying to publish and subscribe
from different machine.

I have created TCF and Topic under InitCtx/JMSCtx/ and the properties
are as shown below
dis tcf(splTCF)
BROKERCCSUBQ(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE)
BROKERPUBQ(pub.in)
QMANAGER(MQSI_SAMPLE_QM)
SUBSTORE(MIGRATE)
BROKERVER(V1)
USECONNPOOLING(YES)
POLLINGINT(5000)
RESCANINT(5000)
CLIENTID(webdev1)
CLONESUPP(DISABLED)
BROKERQMGR(MQSI_SAMPLE_QM)
BROKERSUBQ(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE)
STATREFRESHINT(60000)
TRANSPORT(CLIENT)
HOSTNAME(webdev1)
CHANNEL(java.channel)
SYNCPOINTALLGETS(NO)
PUBACKINT(25)
CCSID(819)
CLEANUPINT(3600000)
PORT(1414)
MSGSELECTION(CLIENT)
VERSION(2)
MSGBATCHSZ(10)
BROKERCONQ(SYSTEM.BROKER.CONTROL.QUEUE)

dis t(new)

FAILIFQUIESCE(YES)
CLEANUP(SAFE)
FAILIFQUIESCE(YES)
BROKERDURSUBQ(SYSTEM.JMS.D.SUBSCRIBER.QUEUE)
TOPIC(comp/topic)
BROKERVER(V1)
PERSISTENCE(APP)
CCSID(1208)
TARGCLIENT(JMS)
ENCODING(NATIVE)
BROKERCCDURSUBQ(SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE)
PRIORITY(APP)
EXPIRY(APP)
VERSION(1)

I have created a simple message flow in MQIntegrator consisting of
MQinput and publish queue .pub.in is specified as input queue for the
message flow.

I have specified ICF in the program as
private static String icf
="com.ibm.ejs.ns.jndi.CNInitialContextFactory";
private static String url
="iiop://webdev1.pok.ibm.com:900/?TargetContext=jmsctx";

Now JMS program is able to connect to server and able to get the
reference of TCF and topic,creating publisher ,creating
subscriber,publishing message.but while receiving the message it is
giving null pointer exception.
When I checked in the MQ, MQ.JMS.ND.SUBSCRIBER.QUEUE has the new
messages in it.
All messages are getting queued up in the queue and subscriber is not
able to receive the messages.Each message published from the publisher
producing 6 messages in the subscriber queue.
when I check the Application Log in the eventviewer it is showing the
following error .

message (???=ip number): Error on receive from host ???.??.??.??? An
error
occured receiving data from ???.??.??.??? over TCP/IP. This may be due
to a
communications failure. The return code from the TCP/IP (recv) call
was
10054 (X\'2746\'). Record these values and tell the system
administrator.
Event# 9208.

I am adding the code snippet below

package client;

import javax.jms.*;
import javax.naming.*;
import javax.naming.directory.*;

import java.io.*;
import java.util.*;
import com.ibm.mq.jms.*;
import com.ibm.mq.*;
import com.ibm.ejs.*;

public class Sub {

private static String icf
="com.ibm.ejs.ns.jndi.CNInitialContextFactory";
private static String url
="iiop://webdev1.pok.ibm.com:900/?TargetContext=jmsctx";

public Sub(){

}
public static void main (String []args){
try{

Hashtable env = new Hashtable();
env.put( Context.INITIAL_CONTEXT_FACTORY, icf );
env.put( Context.PROVIDER_URL, url );
env.put( Context.REFERRAL, "throw" );
env.put( Context.SECURITY_AUTHENTICATION,"none");

TopicConnectionFactory fact =
(TopicConnectionFactory) ctx.lookup("splTCF" );

System.out.println(fact);

TopicConnection tc = fact.createTopicConnection();

System.out.println(tc.getClientID());

TopicSession ts =
tc.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
Topic t = (Topic)ctx.lookup( "new" );
TopicPublisher pub = ts.createPublisher(t);
System.out.println("created publisher");
TopicSubscriber sub = ts.createSubscriber(t);
tc.start();

TextMessage hello = ts.createTextMessage();
hello.setText("<Comment>its working</Comment>");
System.out.println("step4");

pub.publish(hello);
System.out.println("published"+hello);

TextMessage msg = (TextMessage)sub.receive(10000);

System.out.println(msg.getText());


pub.close();
sub.close();
ts.close();
tc.close();
System.out.println("Exiting");

System.exit(0);
}catch(Exception e){
System.out.println("Error is :"+e);
e.printStackTrace();

}





}
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » sub.receive() not getting message from sub queue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.