Author |
Message
|
Vgowda |
Posted: Mon Jan 30, 2012 4:51 am Post subject: Error while calling JAVA Methods from ESQL |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
Hi,
I am calling 2 Java methods from ESQL as shown below.
ESQL Code
Quote: |
DECLARE Var1 CHARACTER 'Request Message received ';
DECLARE Var2 CHARACTER 'Request Msg is ';
DECLARE MsgRef REFERENCE TO InputRoot.SOAP."Body";
CALL Proc1(Var1);
CALL Proc2(Var2,MsgRef);
CREATE PROCEDURE Proc1( IN P1 CHARACTER )
LANGUAGE JAVA
EXTERNAL NAME "com.Logger.debug";
CREATE PROCEDURE Proc2 (IN Var1 CHARACTER, INOUT Var2 REFERENCE )
LANGUAGE JAVA
EXTERNAL NAME "com.Logger.debug"; |
But getting below mentioned error for 2nd Method. If i invoke the same methods from javacompute node it works fine.
Error
Quote: |
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlRoutine.cpp
Line:INTEGER:1153
Function:CHARACTER:SqlRoutine::resolveExternalJavaParameters
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:SampleInfo#FCMComposite_1_5
Label:CHARACTER:SampleInfo.Capture
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:3202
Text:CHARACTER:An error occured whilst trying to locate a Java Class / method
Insert
Type:INTEGER:5
Text:CHARACTER:.SampleInfo_Compute.myProc2
Insert
Type:INTEGER:5
Text:CHARACTER:1.2
Insert
Type:INTEGER:5
Text:CHARACTER:com.Logger.debug
Insert
Type:INTEGER:5
Text:CHARACTER:myProc2
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlExternalJava.cpp
Line:INTEGER:1115
Function:CHARACTER:ESQL2JavaMethodResolver::decodeReturnStatus
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2946
Text:CHARACTER:The Java method could not be found
Insert
Type:INTEGER:5
Text:CHARACTER:com.Logger.debug |
I am using WMB 6.1.0.10 runtime and 6.1.0.3 toolkit.
Any thoughts on this would be helpful. _________________ Regards
Vinay |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 30, 2012 5:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What java type maps to a REFERENCE variable? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Jan 30, 2012 5:39 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Also, you seem to be attempting to call Logger directly without initializing it first. This would not work properly, even in Java. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Esa |
Posted: Mon Jan 30, 2012 5:52 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
lancelotlinc wrote: |
Also, you seem to be attempting to call Logger directly without initializing it first. This would not work properly, even in Java. |
Of course it would. The java methods referenced by an ESQL wrapper are supposed to be static.
Maybe that's what is wrong with the OP's scenario?
Well, we cannot tell because he has not posted his java code. |
|
Back to top |
|
 |
Vgowda |
Posted: Mon Jan 30, 2012 6:20 am Post subject: |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
Found the error. It was because i was using INOUT reference, and in java code i was using like this
Quote: |
public static void debug2(String message, MbElement Msg) |
changed the reference to IN and it worked. For INOUT i should have created the reference like
Quote: |
public static void debug2(String message, MbElement[] Msg) |
Silly mistake from myside.
thank you all for the response  _________________ Regards
Vinay |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 30, 2012 6:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vgowda wrote: |
Found the error. It was because i was using INOUT reference, and in java code i was using like this
Quote: |
public static void debug2(String message, MbElement Msg) |
|
So when you reviewed the rules for mapping between ESQL and Java types, you found the issue?
I wonder if that's why I asked what the mapping for the type you specified was. |
|
Back to top |
|
 |
Vgowda |
Posted: Mon Jan 30, 2012 8:16 pm Post subject: |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
mqjeff : Yes, while reviewing the mapping table found the issue. _________________ Regards
Vinay |
|
Back to top |
|
 |
|