Author |
Message
|
Mercury |
Posted: Wed Nov 22, 2006 11:07 pm Post subject: Calling Java function from ESQL Compute |
|
|
 Apprentice
Joined: 24 Jun 2006 Posts: 32 Location: Hyderabad
|
Hi MBians,
I am trying to call java function from my Compute node esql using below
esql
Quote: |
this is prototype in esql
CREATE FUNCTION Java2ESQl( IN P1 INTEGER,IN P2 INTEGER )
RETURNS INTEGER
LANGUAGE JAVA
EXTERNAL NAME "java.test.Hello.add";
|
in Main function of compute
Quote: |
set Environment.Variables.Result=Java2ESQl(10,5);
|
My java class in a separate project is
Quote: |
package java.test;
public class Hello {
public static long add(long a,long b) {
long res=0;
res=a+b;
return res;
}
}
|
my flow is MQInput- Compute(Which calls ext java)-MQOutput
after deploying jar and cmf file
I am repeatedly getting this exception
Dequeued failed message. Propagating a message to failure terminal
what might be reason 4 this
Whether any SecurityException thrown in java module
Please guide me
Thanks in advance  |
|
Back to top |
|
 |
mgk |
Posted: Thu Nov 23, 2006 1:20 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
I'm not sure why you are getting this exception, but the parameters (and return value) for the Java method must NOT the the java primitive datatypes, they must be the object wrapper types. In your case this should be java.lang.Long not long.
Regards, _________________ 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 |
|
 |
Mercury |
Posted: Thu Nov 23, 2006 2:29 am Post subject: |
|
|
 Apprentice
Joined: 24 Jun 2006 Posts: 32 Location: Hyderabad
|
thank you fot the reply
but i am getting the same exception " Dequeued failed message. Propagating a message to failure terminal "
after changing long to java.lang.Long
can any one tell me possible reasons for this
thanks in advance |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 23, 2006 12:18 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Merecury wrote: |
thank you fot the reply
but i am getting the same exception " Dequeued failed message. Propagating a message to failure terminal "
after changing long to java.lang.Long
can any one tell me possible reasons for this
thanks in advance |
Well I don't believe you can just change long to java.lang.Long...
you might have to do something like that:
Code: |
Long longres = new Long(res);
return longres; |
Automatic boxing only happens since java 1.5 I believe...
And of course change your java function signature to return Long...or should it return Long[] with the first entry being your response?
Enjoy
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
Mercury |
Posted: Mon Nov 27, 2006 1:24 am Post subject: (Solved) Calling Java function from ESQL Compute |
|
|
 Apprentice
Joined: 24 Jun 2006 Posts: 32 Location: Hyderabad
|
Problem solved
public static Long myMethod3(Long Opd1,Long Opd2 ,Long[] Res3) {
int temp_a,temp_b,temp_res;
temp_a=Opd1.intValue();
temp_b=Opd2.intValue();
temp_res=temp_a+temp_b;
Long res=new Long(temp_res);
return res;
}
thanks for all who posted their suggestions in this thread |
|
Back to top |
|
 |
|