|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Error while calling java method using esql |
« View previous topic :: View next topic » |
Author |
Message
|
IBM_Newbie |
Posted: Thu Dec 08, 2011 11:00 pm Post subject: Error while calling java method using esql |
|
|
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 |
|
 |
Esa |
Posted: Thu Dec 08, 2011 11:31 pm Post subject: |
|
|
 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 |
|
 |
McueMart |
Posted: Fri Dec 09, 2011 12:44 am Post subject: |
|
|
 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 |
|
 |
rekarm01 |
Posted: Fri Dec 09, 2011 3:14 am Post subject: Re: Error while calling java method using esql |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|