|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Java User defined extensions and Exception Handling |
« View previous topic :: View next topic » |
Author |
Message
|
hallmark |
Posted: Mon May 23, 2005 4:40 am Post subject: Java User defined extensions and Exception Handling |
|
|
 Voyager
Joined: 10 Mar 2005 Posts: 76
|
Hello,
I am at my wit's end trying to write a java user defined extension. I have written one that writes to a database using JDBC. However I cannot figure out how to deal with exceptions (e.g. SQLException). I catch the exception in the evaluate method, but I need to throw it out of the node so that it can be dealt with using a subsequent error handling flow. I try to create an MbUserException as follows
throw new MbUserException(this.getClass().getName(), "DatabaseInsertClobNode",
"resources",
"SQLE",
sqle.getMessage(),
new Object[]{sqle});
using the documented constructor.
public MbUserException(String className,
String methodName,
String messageSource,
String messageKey,
String traceText,
Object[] inserts)
I think message source and key can refer to a ResourceBundle which I have tried to implement.
I don't know what inserts are???
I have a resource file which consists of key value pairs for error messages but my message comes out as follows:
<com.ibm.broker.plugin.MbUserException class:com.ibm.semaphore.plugin.DatabaseInsertClobNode method:DatabaseInsertClobNode source:resources key:SQLEmessage: Unable to resolve message: Source: resourcesKey: SQLE >
Further up the exception list:
Unhandled exception in plugin method
I can find no documentation to carry out error handling, most sample code I have found just perform System.out.println statements (Great!)
Has anyone succesfully done anything similar?
Thanks in advance
Rob |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon May 23, 2005 4:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Inserts are pieces of text that are inserted into placeholders in your error message - like "Missing database table &1 in statement &2"
The error message is saying that it is looking in the resources it has and can't find a message key of 'SQLE'. If that key is valid in your ResourceBundle, then it is not able to find your ResourceBundle for some reason.
This use of ResourceBundles is not documented very well in the Broker documentation - presumably because it is a java standard practice and not any different for Broker. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hallmark |
Posted: Tue May 24, 2005 8:32 am Post subject: ResourceBundles |
|
|
 Voyager
Joined: 10 Mar 2005 Posts: 76
|
Has anyone else implemented the constructor for MbUserException and referred to a ResourceBundle. How was it done?
Thanks
Rob |
|
Back to top |
|
 |
hallmark |
Posted: Tue May 24, 2005 8:37 am Post subject: Thanks |
|
|
 Voyager
Joined: 10 Mar 2005 Posts: 76
|
Sorry Jeff, I meant to say thanks for your response.
Thanks
Rob |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 24, 2005 8:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|