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 Method from ESQL

Post new topic  Reply to topic
 Calling JAVA Method from ESQL « View previous topic :: View next topic » 
Author Message
Vgowda
PostPosted: Mon Feb 20, 2012 8:47 pm    Post subject: Calling JAVA Method from ESQL Reply with quote

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
View user's profile Send private message
ruchir123
PostPosted: Mon Feb 20, 2012 10:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Mon Feb 20, 2012 10:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Vgowda
PostPosted: Tue Feb 21, 2012 4:13 am    Post subject: Reply with quote

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
View user's profile Send private message
Esa
PostPosted: Tue Feb 21, 2012 4:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Vgowda
PostPosted: Tue Feb 21, 2012 4:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Esa
PostPosted: Tue Feb 21, 2012 4:52 am    Post subject: Reply with quote

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
View user's profile Send private message
mgk
PostPosted: Tue Feb 21, 2012 5:14 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
return Boolean[]


actually, you should return
Code:
Boolean
.
_________________
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
Vgowda
PostPosted: Thu Feb 23, 2012 3:30 am    Post subject: Reply with quote

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
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 » Calling JAVA Method from ESQL
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.