Author |
Message
|
smaram1 |
Posted: Wed May 21, 2003 5:41 pm Post subject: jplugin code deploy error |
|
|
Novice
Joined: 06 May 2003 Posts: 19
|
Hi All,
I am trying to create a custom plugin code and i am facing problems. I have a class which converts flat file to xml and this works perfectly in a stand alone enviroment.
Now i am tryng to create a custom node. I have a
CUSTOMNODE extends MbNode implements MbNodeInterface
and all other logic for this.
It compiles and placed jar in jplugin directory and i also created plugin node in CONTROL CENTER and added to flow. When i try to deploy this, i am getting following error.
ERROR:
BIP4368S: The method 'getMethod' has thrown the following exception: java.lang.NullPointerException.
The Java API framework has caught an unhandled Java exception.
Contact the node provider for further details.
I dont see getMethod anywhere in my code.
Any help would be really appreciated.
Thanks
Suresh |
|
Back to top |
|
 |
kirani |
Posted: Thu May 22, 2003 3:50 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Suresh,
Could you post your plug-in code here (no need to post the code for Evaluate method or the code in the utility class)? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
smaram1 |
Posted: Thu May 22, 2003 3:59 pm Post subject: |
|
|
Novice
Joined: 06 May 2003 Posts: 19
|
Thanks for the reply Kiran..
Okay..here is the code..
i am pasting all extra methods which i used for logging..but jus to be on safe side i am posting them too..
public class HuddNode extends MbNode implements MbNodeInterface {
/** Reference to the log file */
private File log;
/** Debug switch */
private boolean debug;
/** Contains the instance of the Singleton ParserPool */
//private ParserPool parserPool;
/** Holds the reference to the current parser */
private NodeParser nodeParser;
/** Holds the reference to the current byte array from the incomming message */
private byte bytes[];
/** Node name */
private static final String NODE_NAME = "DkMaerskDataHuddNode";
/** HuddNode constructor */
public HuddNode() throws MbException {
createInputTerminal("in"); //Create in inputterminal
createOutputTerminal("out"); //Create out outputterminal
createOutputTerminal("failure"); //Create failure outputterminal
}
/** MbNodeInterface evaluate method */
public void evaluate(MbMessageAssembly assembly, MbInputTerminal inputTerminal) throws MbException {
//THIS IS WHERE I AM USING THE UTILITY CLASS AND POSTING IT OUT AND FAILURE TERMINALS
}
/** Method used by the WMQI to tie reference to this object */
public static String getNodeName() {
return NODE_NAME;
}
/** Method called by WMQI from Log file is on */
public void setLogFile(String file){
log = new File(file);
}
/** Method called by WMQI */
public String getLogFile(){
return log.toString();
}
/** Method called by WMQI if tracing is on */
public void setDebugOn(String s) {
if(s != null && s.equalsIgnoreCase("on"))
debug = true;
else
debug = false;
}
/** Method called by WMQI */
public String getDebugOn() {
return "" + debug;
}
/** Old facion log method that works in 1.3.- */
public void log(String entry){
if(debug){ //Only write to log if debug is on
try{
if(log == null) //If the logfile isn't set create a temporary file
log = File.createTempFile(getClass().getName(),"log");
StringBuffer content = new StringBuffer(); //Instantiate buffer to hold old file content
BufferedReader in = new BufferedReader(new InputStreamReader(log.toURL().openStream())); //Open the stream from the the file
String line;
while((line = in.readLine()) != null){ //While the old message contains lines add them to the new content
content.append(line + '\n');
}
in.close(); //Close the reader
content.append(new java.util.Date().toString() + " | " + entry); //Append the new entry with a timestamp
FileWriter fw = new FileWriter(log); //Instantiate a file writer
fw.write(content.toString()); //Write the new content to the file
fw.close(); //Close the writer
}
catch(Exception x){
//Do nothing if it fails
}
}
}
}
Pls let me know if i need to post evaluate(0 method too..
Thanks |
|
Back to top |
|
 |
kirani |
Posted: Thu May 22, 2003 4:34 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Okay ... I have made some changes in the code and they are highlighted. Hopefully this will take you a step further. Also, I didn't see any attribute defined in your plug-in configuration files. Don't you need atleast one attribute to take input file name?
Quote: |
public class HuddNode extends MbNode implements MbNodeInterface {
/** Reference to the log file */
private File log;
/** Debug switch */
private boolean debug;
/** Node name */
private static final String NODE_NAME = "HuddNodeNode";
/** HuddNode constructor */
public HuddNode() throws MbException {
createInputTerminal("in"); //Create in inputterminal
createOutputTerminal("out"); //Create out outputterminal
createOutputTerminal("failure"); //Create failure outputterminal
}
/** MbNodeInterface evaluate method */
public void evaluate(MbMessageAssembly assembly, MbInputTerminal inputTerminal) throws MbException {
//THIS IS WHERE I AM USING THE UTILITY CLASS AND POSTING IT OUT AND FAILURE TERMINALS
/** Contains the instance of the Singleton ParserPool */
//private ParserPool parserPool;
/** Holds the reference to the current parser */
NodeParser nodeParser;
/** Holds the reference to the current byte array from the incomming message */
byte bytes[];
}
/** Method used by the WMQI to tie reference to this object */
public static String getNodeName() {
return NODE_NAME;
}
/** Method called by WMQI from Log file is on */
public void setLog(String file){
log = new File(file);
}
/** Method called by WMQI */
public String getLog(){
return log.toString();
}
/** Method called by WMQI if tracing is on */
public void setDebug(String s) {
if(s != null && s.equalsIgnoreCase("on"))
debug = true;
else
debug = false;
}
/** Method called by WMQI */
public String getDebug() {
return "" + debug;
}
/** Old facion log method that works in 1.3.- */
public void log(String entry){
if(debug){ //Only write to log if debug is on
try{
if(log == null) //If the logfile isn't set create a temporary file
log = File.createTempFile(getClass().getName(),"log");
StringBuffer content = new StringBuffer(); //Instantiate buffer to hold old file content
BufferedReader in = new BufferedReader(new InputStreamReader(log.toURL().openStream())); //Open the stream from the the file
String line;
while((line = in.readLine()) != null){ //While the old message contains lines add them to the new content
content.append(line + '\n');
}
in.close(); //Close the reader
content.append(new java.util.Date().toString() + " | " + entry); //Append the new entry with a timestamp
FileWriter fw = new FileWriter(log); //Instantiate a file writer
fw.write(content.toString()); //Write the new content to the file
fw.close(); //Close the writer
}
catch(Exception x){
//Do nothing if it fails
}
}
}
}
|
hope this helps. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
smaram1 |
Posted: Thu May 22, 2003 5:36 pm Post subject: |
|
|
Novice
Joined: 06 May 2003 Posts: 19
|
Hi Kiran,
That did the trick. I will pin point the exact change needed out of those and will post here so that it might be useful for others in future.
Do you have any idea both the Debugger issue that posted on another topic.
Thanks for all the help
Suresh |
|
Back to top |
|
 |
smaram1 |
Posted: Tue Sep 16, 2003 2:52 pm Post subject: |
|
|
Novice
Joined: 06 May 2003 Posts: 19
|
Looks like getLogFile() and getLog() is making a diff. Other changes also are needed.
If i use getLog() name, it is throwing NullPointerException. This might be due to an exisitng method in MQ API.
If i use getLogFile() signature, everything deploys perfectly. |
|
Back to top |
|
 |
|