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 » ESQL return type does not match

Post new topic  Reply to topic
 ESQL return type does not match « View previous topic :: View next topic » 
Author Message
KIT_INC
PostPosted: Mon Dec 19, 2011 11:26 am    Post subject: ESQL return type does not match Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

using WMB 61 on Windows or AIX. Try to create a function to get a timestamp in milliseconds

Create Function GetUnixTime() Returns INTEGER
Language Java External Name "java.lang.System.currentTimeMillis";

I call the function from within my ESQL code.

The code was deployed with no error.

But Keep getting error during execution "The Java method 'java.lang.System.currentTimeMillis' was found but its return type does not match the ESQL return type"

I know that java.lang.System.currentTimeMillis reurns long. According to info center
ESQL datatype INTEGER maps to java.lang.Long and that is what is used in the create function.

Any suggestion ?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Dec 19, 2011 11:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you tried mapping it to integer[]
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
KIT_INC
PostPosted: Mon Dec 19, 2011 12:12 pm    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

Sorry fjp_saper, not sure what you mean by "Have you tried mapping it to integer[] "

In the compute node that calls the function I have
tried
SET Environment.DATA.UTIME= GetUnixTime();

or Declare UTIME int;
set UTIME = GetUnixTime();

Just to be sure that it is not the calling ESQL causing the failure, I put the declare function and calling ESQLs within the same comute module and I commented out all the ESQL that calls the function. The failure is the same. So the problem is likely with the create function statement.
I don't know what to put in the the "Returns INTEGER " I did try with
"Returns decimal" (just try my luck) but same failure.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Dec 19, 2011 12:44 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Your Java function is not correct. It should read:

Code:
return (int) (System.currentTimeMillis() / 1000L);

_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
lancelotlinc
PostPosted: Mon Dec 19, 2011 12:53 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Alternately, if you didn't want to divide by 1,000, you could use modulo to get the numeric down into an int.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon Dec 19, 2011 1:47 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I thought he said java returned a Long (autoboxed long) and he was mapping it to Integer in ESQL??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
lancelotlinc
PostPosted: Mon Dec 19, 2011 2:05 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

He did say that. I am suggesting he cast his Java return to an int and use modulo to get the proper value.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Mon Dec 19, 2011 2:25 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi.

This error is because the ESQL INTEGER type maps to
Code:
java.lang.Long
which is the class (object) version of long and not the primitive long. The method you are trying to call returns the primitive so is not compatible. To call this method you will need to wrap it in a java method that returns the value as a
Code:
Long
.

Kind 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
KIT_INC
PostPosted: Tue Dec 20, 2011 6:31 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

Thanks for the suggestions. I am a java beginner. I'll try and feedback.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ESQL return type does not match
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.