Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error! while extracting message from MQ by using an EA Server Service component

3 views
Skip to first unread message

Stanley

unread,
Jan 14, 2003, 1:56:35 AM1/14/03
to
Hi all,
I have written a Service component in EA Server and extracting message
from the message queue of IBM MQSeries. The service component is
written to handle both text message and Object message. The service
component would get the text message without any problem. However, if
it receives a object message, an exception is thrown as below.

Exception:java.lang.NullPointerException
Jan 14 11:29:20 2003: java.lang.NullPointerException
Jan 14 11:29:20 2003: at
com.ibm.jms.MQObjectInputStream.resolveClass(MQObjectInputStream.java:88)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
Jan 14 11:29:20 2003: at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
Jan 14 11:29:20 2003: at
com.ibm.jms.JMSObjectMessage.getObject(JMSObjectMessage.java:256)
Jan 14 11:29:20 2003: at
TestServiceComp.TestServiceImpl.handleObjectMessage2(TestServiceImpl.java:192)
Jan 14 11:29:20 2003: at
TestServiceComp.TestServiceImpl.onMessage(TestServiceImpl.java:127)
Jan 14 11:29:20 2003: at
com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:731)
Jan 14 11:29:20 2003: at
com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:283)
Jan 14 11:29:20 2003: at java.lang.Thread.run(Thread.java:484)


private void handleObjectMessage(Message message){
CacheItem ci=null;
System.out.println("Get a Object message");
try{
-----> java.io.Serializable obj=((ObjectMessage)message).getObject();
System.out.println("This is after the assingment");
if (obj instanceof CacheItem){
if (obj!=null){
ci=(CacheItem)obj;
System.out.println( "Receive object by
"+Thread.currentThread().getName()+":");
System.out.println(ci);
if (ci.value.trim().equals("z")){
System.out.println("Sender request to quit!");
blnExit = true;
}
else{
CacheFactory.getMainCache().put(ci);
}
}
else{
System.out.println("object is null!");
}

}
if (obj instanceof String){
System.out.println("an Object string message is received:"+obj);
}
}
catch(MessageFormatException mfe){
System.out.println("MessageFormat:"+mfe);
mfe.printStackTrace();
}
catch (JMSException jmse) {
System.out.println("handleObjectMessage error!");
jmse.printStackTrace();
}
catch(Exception e){
System.out.println("Exception:"+e);
e.printStackTrace();

}
}


The class of the object is defined below
package testCache;

public class CacheItem implements java.io.Serializable {
public String key;
public String value;

public CacheItem(){
}
public CacheItem(String keyvalue, String itemvalue){
this.key=keyvalue;
this.value=itemvalue;

}
public String toString(){
return "Key:"+this.key+" value:"+this.value;
}

}

However if the object is a string, it has no problem.
I have set the classpath for the CacheItem in the component level
the setting like below

testCache.jar
testCache.*


Anyone have the idea about this problem?
Stanley

Bruce Armstrong

unread,
Jan 17, 2003, 4:50:18 PM1/17/03
to
The method you are using to post your message isn't supported by the
Sybase newsgroup servers. As a result, only people using services
like Google can see your message. If you want everyone else to see
your post, you need to either connect directly to forums.sybase.com
with a standard newsreader, or use the web based newsreaders at
http://www.pfcguide.com or http://my.sybase.com.

itssta...@yahoo.com.hk (Stanley) wrote in message news:<e7f1c933.03011...@posting.google.com>...

0 new messages