Author |
Message
|
Vgowda |
Posted: Mon Feb 20, 2012 8:47 pm Post subject: Calling JAVA Method from ESQL |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
Hi All,
I am working on WMB V6.1, i have written a function in Java which returns Boolean Data type. I am trying to access the same from ESQL but it gives Type mismatch error.
Code
In ESQL
Code: |
CREATE PROCEDURE isEventEnabled ()
RETURNS BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.emm.event.EventEnv.isEventEnabled"; |
Method in Java which returns Boolean ()
Code: |
public static boolean isEventEnabled() {
return com.emm.core.event.EventEnv.isEventEnabled( ROOT_ENTRY_KEY ); |
I am getting below mentioned error
Quote: |
ExceptionList
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbDataFlowNode.cpp
Line:INTEGER:967
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmSOAPInputNode
Name:CHARACTER:SampleInfo#FCMComposite_1_1
Label:CHARACTER:SampleInfo.Receive Request
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbComputeNode.cpp
Line:INTEGER:464
Function:CHARACTER:ImbComputeNode::evaluate
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:SampleInfo#FCMComposite_1_7.gen/SF_SampleInfo#FCMComposite_1_32
Label:CHARACTER:SampleInfo.SF_SampleInfo.isEventEnabled
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
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_7.gen/SF_SampleInfo#FCMComposite_1_32
Label:CHARACTER:SampleInfo.SF_SampleInfo.isEventEnabled
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:.isEventEnabled
Insert
Type:INTEGER:5
Text:CHARACTER:1.1
Insert
Type:INTEGER:5
Text:CHARACTER:com.emm.event.EventEnv.isEventEnabled
Insert
Type:INTEGER:5
Text:CHARACTER:isEventEnabled
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlExternalJava.cpp
Line:INTEGER:1123
Function:CHARACTER:ESQL2JavaMethodResolver::decodeReturnStatus
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2928
Text:CHARACTER:The Java return type does not match the ESQL return type
Insert
Type:INTEGER:5
Text:CHARACTER:com.emm.event.EventEnv.isEventEnabled |
Any thoughts on the error would be gr8ly appreciated.
Thanks in advance _________________ Regards
Vinay |
|
Back to top |
|
 |
ruchir123 |
Posted: Mon Feb 20, 2012 10:01 pm Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Hi Vgowda,
Your trace shows 'The Java return type does not match the ESQL return type'.
It means your return from java is not of type expecting by ESQL.
I think the return from java should be of Boolean type.
So please try by retruning a boolean. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Feb 20, 2012 10:38 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
This table here ->
may help you in your quest for a solution. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vgowda |
Posted: Tue Feb 21, 2012 4:13 am Post subject: |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
Quote: |
smdavies99
This table here -> |
I tried as per the table and changed the code as below.
Code: |
SET Environment.MsgDetails.EventStatus = EventEnabled();
SET isEventEnabledVar = CAST(Environment.MsgDetails.EventStatus AS BOOLEAN);
CREATE PROCEDURE EventEnabled ()
RETURNS BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.emm.event.EventEnv.isEventEnabled";
public static boolean[] isEventEnabled() {
return new boolean[] {com.emm.core.event.EventEnv.isEventEnabled( ROOT_ENTRY_KEY )};
} |
Still no luck
Giving the same error.. Any thoughts on the same would be gr8  _________________ Regards
Vinay |
|
Back to top |
|
 |
Esa |
Posted: Tue Feb 21, 2012 4:22 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Please post your whole java code so that we can see if the package and class names are correct.
There is a certain difference between boolean and Boolean... |
|
Back to top |
|
 |
Vgowda |
Posted: Tue Feb 21, 2012 4:28 am Post subject: |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
@Esa : As error states it is return type mismatch
Quote: |
<Number>2928</Number>
<Text>The Java return type does not match the ESQL return type</Text>
<Insert>
<Type>5</Type>
<Text>com.emm.event.EventEnv.isEventEnabled</Text>
</Insert> |
The Java code is
Code: |
package com.emm.event;
public class EventEnv {
public static boolean[] isEventEnabled() {
return new boolean[] {com.emm.core.event.EventEnv.isEventEnabled( ROOT_ENTRY_KEY )};
}
} |
_________________ Regards
Vinay |
|
Back to top |
|
 |
Esa |
Posted: Tue Feb 21, 2012 4:52 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Vgowda wrote: |
@Esa : As error states it is return type mismatch
|
Yes, and you are still returning boolean[] while you should return Boolean[] |
|
Back to top |
|
 |
mgk |
Posted: Tue Feb 21, 2012 5:14 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
actually, you should return
. _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
Vgowda |
Posted: Thu Feb 23, 2012 3:30 am Post subject: |
|
|
 Acolyte
Joined: 11 Dec 2007 Posts: 61 Location: Bengaluru
|
Thanks mgk and Esa .
Changed the code as mentioned below and it worked
Code: |
public static Boolean isEventEnabled() {
return new Boolean(com.slk.emm.core.event.EventEnv.isEventEnabled( ROOT_ENTRY_KEY ));
} |
_________________ Regards
Vinay |
|
Back to top |
|
 |
|