Author |
Message
|
CuriCAT |
Posted: Mon Oct 13, 2008 8:58 am Post subject: Problem Calling JAVA METHOD from ESQL with REFERENCE as IN |
|
|
 Voyager
Joined: 26 Sep 2006 Posts: 82
|
I am facing a problem when I call a java routing from ESQL only when when I pass REFERENCE as a Parameter.
please find the detail below.
Broker Toolkit 6.0.2:
If I make a reference in ESQL to JAVA method with string as input parameter I don't see any error.
Example 1:
at ESQL:
CREATE PROCEDURE hashValue2 (
IN Value CHAR
)
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.xyz.CommonJavaFunctions_JavaCompute.hashValue2";
at java :
public static String hashValue2(String value) {
return "";
}
EXAMPLE2 : If I use REFERENCE as an input parameter I am getting error Unable to locate a class definition named "com.xyz.CommonJavaFunctions_JavaCompute" in the project or a referenced project.
at ESQL
CREATE PROCEDURE hashValue2 (
IN Value REFERENCE
)
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.xyz.CommonJavaFunctions_JavaCompute.hashValue2";
at java :
public static String hashValue2(MbElement value) {
return "";
}
have any one faced similer problem? please let me know if you got any suggestions, i am sure it is not related to PROJECT references or classpath, it doesn't give any error if I change the parameter type, I greatly appreciate your help. |
|
Back to top |
|
 |
Esa |
Posted: Tue Oct 14, 2008 7:12 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I think you can only pass references to java as INOUT parameters. |
|
Back to top |
|
 |
broker_new |
Posted: Tue Oct 14, 2008 7:59 am Post subject: |
|
|
 Yatiri
Joined: 30 Nov 2006 Posts: 614 Location: Washington DC
|
Try something like this,it is working code in Prod ..
(remember getCorrelationIDInBytes method is in JCN and the jar file is deployed on broker).
CREATE PROCEDURE getCorrelationIDInBytes(IN MESSAGEID CHARACTER)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.util.broker.BrokerUtilities.getCorrelationIDInBytes";
public static byte[] getCorrelationIDInBytes(String id){
return id.getBytes();
} |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 14, 2008 8:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
String.getBytes() will not return a byte representation of the correlId being passed as String! It will return a byte representation of that String. Completely different!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mgk |
Posted: Tue Oct 14, 2008 8:36 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi.
This is incorrect:
Quote: |
I think you can only pass references to java as INOUT parameters |
You can do what you are trying to do, and your signatures look correct. So did the java class really get deployed when you changed the signature? I would have both methods in the same class as a test (each with a slightly different name) and try calling both methods, one after another from ESQL. If this still fails, when maybe you should raise a PMR as IN REFERENCEs to a java method should work.
Regards _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Last edited by mgk on Tue Oct 14, 2008 1:36 pm; edited 1 time in total |
|
Back to top |
|
 |
CuriCAT |
Posted: Tue Oct 14, 2008 9:21 am Post subject: |
|
|
 Voyager
Joined: 26 Sep 2006 Posts: 82
|
Thanks for you response guys!
mgk is RIGHT.
I have used such methods in my previous project ... REFERENCE as just IN (input) parameter.
I got the problem resolved.. its because of project reference only.
I have checked out project from StarTeam and .project was read only file. the java project reference which I made wasn't get updated.
Thanks for the alternative ideas.. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 14, 2008 9:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
CuriCAT wrote: |
mgk is RIGHT. |
He usually is. |
|
Back to top |
|
 |
mgk |
Posted: Tue Oct 14, 2008 1:38 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Thanks
Cheers, _________________ 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 |
|
 |
kuladeep.dairy |
Posted: Tue Nov 17, 2009 12:06 am Post subject: getCorrelationIDInBytes method is in JCN and the jar file is |
|
|
Apprentice
Joined: 11 Jul 2009 Posts: 38
|
Hi
can you please let know where i can find this jar. i am not able to find it.
Many Thanks.. |
|
Back to top |
|
 |
gauravg |
Posted: Wed May 11, 2016 2:28 am Post subject: |
|
|
Novice
Joined: 12 Jan 2016 Posts: 14
|
Hi,
I am facing similar issue when try to pass reference to Java method. In IIB 10.0.0.2, I have prepared one Application which is referencing one java project. This java project contains method with parameter as MbElement.
When I try to deploy the bar file (containing this application and its dependency), I got same error : signature mismatch).
When I change signature to simple datatype as String, then it gets deployed successfully.
I have tried with IN, INOUT both, but still its giving same error when passing reference. There is no read only marked in .project file in java project.
Please suggest.
Thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 11, 2016 3:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
gauravg wrote: |
Hi,
I am facing similar issue when try to pass reference to Java method. In IIB 10.0.0.2, I have prepared one Application which is referencing one java project. This java project contains method with parameter as MbElement.
When I try to deploy the bar file (containing this application and its dependency), I got same error : signature mismatch).
When I change signature to simple datatype as String, then it gets deployed successfully.
I have tried with IN, INOUT both, but still its giving same error when passing reference. There is no read only marked in .project file in java project.
Please suggest.
Thanks |
Delete the .class files and jar files relating to the java project to force a new build when creating the bar file. See if it works after deploying that bar files. With java projects I would not try the hot deploy but remover and add the application again. If you try a hot deploy there are chances that your java project does not get the correct new version... especially if the methods have the same name...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|