ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling Java function from ESQL Compute

Post new topic  Reply to topic
 Calling Java function from ESQL Compute « View previous topic :: View next topic » 
Author Message
Mercury
PostPosted: Wed Nov 22, 2006 11:07 pm    Post subject: Calling Java function from ESQL Compute Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
mgk
PostPosted: Thu Nov 23, 2006 1:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Mercury
PostPosted: Thu Nov 23, 2006 2:29 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
fjb_saper
PostPosted: Thu Nov 23, 2006 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Mercury
PostPosted: Mon Nov 27, 2006 1:24 am    Post subject: (Solved) Calling Java function from ESQL Compute Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling Java function from ESQL Compute
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.