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 » Accessing Global environment Variables in JavaCoputeNode

Post new topic  Reply to topic
 Accessing Global environment Variables in JavaCoputeNode « View previous topic :: View next topic » 
Author Message
bpkumar2
PostPosted: Wed Dec 26, 2012 8:09 am    Post subject: Accessing Global environment Variables in JavaCoputeNode Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 8

I have set the below environment in the compute node
SET Environment.Variables.FileName =InputRoot.XMLNSC.MAIN.INPUT1.CONTENT.FILENAME;

and trying to access the same environment variable in Java copute node which is connected to the coputenode, using below sinppet. But I am not able to get the value of varaible. i am getting : java.lang.NullPointerException.
I googled to find out the correct usgae, but I am not getting any working sample.

JavaCompute node snippet.

MbElement env = assembly.getGlobalEnvironment().getRootElement() ;
MbElement env_fileName =env.getFirstElementByPath("Variable/FileName");
String fileName=env_fileName.toString();
logger.debug(">>> File Name:: >>>>"+fileName);
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Dec 26, 2012 8:24 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

1. Use [c od e] blocks when posting here.

2. You mis-spelled 'Variables'.


Where are your Trace nodes? If you had used Trace nodes, you could have figured this out on your own.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
bpkumar2
PostPosted: Wed Dec 26, 2012 8:39 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 8

lancelotlinc wrote:
1. Use [c od e] blocks when posting here.
.

I will follow the standards.

lancelotlinc wrote:

2. You mis-spelled 'Variables'..


I have corrected the typo. but still its same issue.

lancelotlinc wrote:

Where are your Trace nodes? If you had used Trace nodes, you could have figured this out on your own. ..



I have used the Trace node, but did not find any error in the trace node....
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Dec 26, 2012 8:51 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

The pattern you could use in your trace node is:

Code:
Root:
${Root}
===
LocalEnvironment:
${LocalEnvironment}
===
Environment:
${Environment}
===
ExceptionList:
${ExceptionList}
===
${CURRENT_TIMESTAMP}
=======================


Please post the output of the Trace node.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
bpkumar2
PostPosted: Wed Dec 26, 2012 10:43 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 8

lancelotlinc wrote:
The pattern you could use in your trace node is:

Code:
Root:
${Root}
===
LocalEnvironment:
${LocalEnvironment}
===
Environment:
${Environment}
===
ExceptionList:
${ExceptionList}
===
${CURRENT_TIMESTAMP}
=======================


Please post the output of the Trace node.


@ Jedi Knight, You can find the Trace hereunder.

(0x01000000:Name ):MQMD = ( ['MQHMD' : 0x1116746d0]
(0x03000000:NameValue):SourceQueue = 'MYQUEUE.OUT' (CHARACTER)
(0x03000000:NameValue):Transactional = TRUE (BOOLEAN)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1208 (INTEGER)
(0x03000000:NameValue):Format = 'MQSTR ' (CHARACTER)
(0x03000000:NameValue):Version = 2 (INTEGER)
(0x03000000:NameValue):Report = 0 (INTEGER)
(0x03000000:NameValue):MsgType = 8 (INTEGER)
(0x03000000:NameValue):Expiry = -1 (INTEGER)
(0x03000000:NameValue):Feedback = 0 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):Persistence = 0 (INTEGER)
(0x03000000:NameValue):MsgId = X'414d51204d5141444556503031202020509f67522d15be99' (BLOB)
(0x03000000:NameValue):CorrelId = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):BackoutCount = 1 (INTEGER)
(0x03000000:NameValue):ReplyToQ = ' ' (CHARACTER)
(0x03000000:NameValue):ReplyToQMgr = 'MQTESTQM ' (CHARACTER)
(0x03000000:NameValue):UserIdentifier = 'testuser ' (CHARACTER)
(0x03000000:NameValue):AccountingToken = X'0000000000000000000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ApplIdentityData = ' ' (CHARACTER)
(0x03000000:NameValue):PutApplType = 28 (INTEGER)
(0x03000000:NameValue):PutApplName = 'WebSphere MQ Client for Java' (CHARACTER)
(0x03000000:NameValue):PutDate = DATE '2012-12-26' (DATE)
(0x03000000:NameValue):PutTime = GMTTIME '18:25:26.980' (GMTTIME)
(0x03000000:NameValue):ApplOriginData = ' ' (CHARACTER)
(0x03000000:NameValue):GroupId = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):MsgSeqNumber = 1 (INTEGER)
(0x03000000:NameValue):Offset = 0 (INTEGER)
(0x03000000:NameValue):MsgFlags = 0 (INTEGER)
(0x03000000:NameValue):OriginalLength = -1 (INTEGER)
)
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x110479ff0]
(0x01000000:Folder):INPUT = (
(0x01000000:Folder):CONTENT_STRING = (
(0x03000000:PCDataField):FILENAME = '/mount1/abcd.txt' (CHARACTER)
(0x03000000:PCDataField):BATCHID = 'A1234567898765' (CHARACTER)
(0x03000000:PCDataField):CHECKSUM = '7d6f674fba991743cde0cead4ef45ac6' (CHARACTER)
(0x01000000:Folder ):GP_NAME = (
(0x03000000:PCDataField):VALUE1 = 'A1' (CHARACTER)
(0x03000000:PCDataField):VALUE2 = 'A2' (CHARACTER)
(0x03000000:PCDataField):VALUE3 = 'A3' (CHARACTER)
)
)
)
)
)
===
LocalEnvironment:

===
Environment:

===
ExceptionList:
( ['MQROOT' : 0x110432f90]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = '/build/S000_P/src/DataFlowEngine/ImbMqInputNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 2010 (INTEGER)
(0x03000000:NameValue):Function = 'ImbCommonInputNode::eligibleForBackout' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmMQInputNode' (CHARACTER)
(0x03000000:NameValue):Name = 'My_Test_Flow#FCMComposite_1_4' (CHARACTER)
(0x03000000:NameValue):Label = 'My_Test_Flow.MQInput' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2652 (INTEGER)
(0x03000000:NameValue):Text = 'Dequeued failed message. Propagating a message to the failure terminal' (CHARACTER)
)
)
===
2012-12-26 10:25:28.009710
Code:
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Dec 26, 2012 11:07 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Notice that 'Environment' is blank. This indicates that your set statement did not successfully execute.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
bpkumar2
PostPosted: Thu Dec 27, 2012 8:50 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 8

lancelotlinc wrote:
Notice that 'Environment' is blank. This indicates that your set statement did not successfully execute.


Thank you for your help, I notied the problem with SET statement and I have corrected it.
Back to top
View user's profile Send private message
kash3338
PostPosted: Thu Dec 27, 2012 9:32 pm    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

bpkumar2 wrote:
Thank you for your help, I notied the problem with SET statement and I have corrected it.


What was the problem? Was there a mistake in parsing the Input tree?
Back to top
View user's profile Send private message Send e-mail
bpkumar2
PostPosted: Fri Dec 28, 2012 12:54 am    Post subject: Reply with quote

Newbie

Joined: 11 Dec 2012
Posts: 8

kash3338 wrote:
bpkumar2 wrote:
Thank you for your help, I notied the problem with SET statement and I have corrected it.


What was the problem? Was there a mistake in parsing the Input tree?


Exactly... There was a mistake in parsing input tree, I was in a impression that it's problem in reading the global variable in java compute node.
but the below mentioned mechanism is correct one.

Code:

Compue node :

SET Environment.Variables.FileName ='/mount1/data/file1.txt';

JCN ::

MbElement env = assembly.getGlobalEnvironment().getRootElement() ;   
String sourceFileName= env.getFirstElementByPath("Variables/FileName").getValueAsString();
       
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 » Accessing Global environment Variables in JavaCoputeNode
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.