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 » Error while calling java method using esql

Post new topic  Reply to topic
 Error while calling java method using esql « View previous topic :: View next topic » 
Author Message
IBM_Newbie
PostPosted: Thu Dec 08, 2011 11:00 pm    Post subject: Error while calling java method using esql Reply with quote

Novice

Joined: 05 Dec 2011
Posts: 15

Hi,

I am getting error that java method not found while calling a java method using esql

My java class is

/**
*
*/

package com.someorg.cache;
import java.util.*;
/**
* @author Administrator
*
*/
public class Cache {

/**
* @param args
*/
static Map hm;

static {
hm = new HashMap();
createHash(hm);
}

public static void createHash(Map hm)
{

// Put elements to the map
hm.put("Vanshul", "Chawla");
hm.put("Anshul","Sah");
hm.put("Anuj", "Bandlish");
}
public static String retrieveHash(String key)
{
String value=(String) hm.get(key);
return value;
}

public static void resetHash()
{
//String value=(String) hm.get(key);
hm.put("Vanshul", "Chawla1");
hm.put("Anshul","Sah1");
hm.put("Anuj", "Bandlish1");
}

/*
public static void initialize() {
// TODO Auto-generated method stub
// Create a hash map

// String value=retrieveHash("Vanshul");
// System.out.println("value is: " +value);
}

*/

}


ESQL in Compute is





CREATE COMPUTE MODULE CacheTest1_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE value CHARACTER '';
CALL retrieveHash('Vanshul') INTO value;
set OutputRoot.xmlnsc.Message.value=value;
RETURN TRUE;
END;

CREATE PROCEDURE retrieveHash( OUT value CHARACTER)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "com.someOrg.cache.Cache.retrieveHash";

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;



Please let me know where is the issue in esql?Am i missing something?
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Dec 08, 2011 11:31 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Yes,

it seems you didn't package your class in a jar file and deploy on the broker.
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri Dec 09, 2011 12:44 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Probably what Esa said, but I believe package names are case sensitive so worth checking your:

package com.someorg.cache;

EXTERNAL NAME "com.someOrg.cache.Cache.retrieveHash";

(I appreciate that someOrg is probably changed from your company name and does match in your actual code - Im just pointing out in case...)
Back to top
View user's profile Send private message
rekarm01
PostPosted: Fri Dec 09, 2011 3:14 am    Post subject: Re: Error while calling java method using esql Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

IBM_Newbie wrote:
Am i missing something?

Aside from [code] tags?

The ESQL-to-Java data-type mapping is different for IN, OUT, and INOUT parameters. Make sure to declare any parameters with the correct direction indicator.
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 » Error while calling java method using 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.