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 » Read blob message using Java Compute node throwing exception

Post new topic  Reply to topic
 Read blob message using Java Compute node throwing exception « View previous topic :: View next topic » 
Author Message
anilmekala
PostPosted: Tue Feb 18, 2014 1:30 am    Post subject: Read blob message using Java Compute node throwing exception Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi All,

I am getting exception while reading blob message in JCN.

I have create flow MQ INput --> JCN --> MQ out . I have set Message domain as blob when am trying to read the blog message am getting null pointer exception. I am pasting my code as below

MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");

MbMessage inMessage = contact admin.getMessage();

MbElement inRoot = inMessage.getRootElement();
MbElement blob = inRoot.getLastChild();

// create new message
MbMessage outMessage = new MbMessage(inMessage);
MbElement outputRoot = outMessage.getRootElement();
MbElement outputBody = outputRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);

byte[] mybytes=(byte[]) blob.getValue();

String MessageBodyString = new String(mybytes);-- getting null pointer exception.

MessageBodyString = MessageBodyString + " adding string text to mesage body";


//text.concat("Welcome");


MbElement blobData = outputBody.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "BLOB", MessageBodyString.getBytes());

MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,
outMessage);

Please help me to resolve the issue.

Thanks in Advance.

Anil.
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Tue Feb 18, 2014 1:56 am    Post subject: Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

The ESQL reference to your BLOB would be:
Code:
InputRoot.BLOB.BLOB


To get at the contents of the blob, you'd therefore have to
Code:
MbElement outerblob = inRoot.getLastChild();
MbElement blob = outerblob.getLastChild(); <--
byte[] mybytes=(byte[]) blob.getValue();
Back to top
View user's profile Send private message Send e-mail
anilmekala
PostPosted: Tue Feb 18, 2014 3:03 am    Post subject: Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi ,

Thank you so much it resolved my issue.

Regards,

Anil.
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 » Read blob message using Java Compute node throwing exception
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.