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 » Call a java function from esql code in WMB v8.0

Post new topic  Reply to topic
 Call a java function from esql code in WMB v8.0 « View previous topic :: View next topic » 
Author Message
rock33
PostPosted: Mon Oct 07, 2013 5:50 am    Post subject: Call a java function from esql code in WMB v8.0 Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Hi All,

I am trying to call user defined java function from esql.

I have created an Message broker application and added the java project (Myutil)as an project reference.

Once the bar file has generated from message broker tool kit Myutil.jar have successfully added as part of bar file.

Java project name : Myutil

Esql Code :

CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();

DECLARE c1 CHARACTER 'Good';
DECLARE c2 CHARACTER 'Morning';
DECLARE c3 CHARACTER;
SET c3 = myProc( c1, c2);
SET OutputRoot.XMLNSC.Result.value=c3;
RETURN TRUE;
END;


CREATE FUNCTION myproc( IN P1 CHARACTER, OUT P2 CHARACTER)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "com.own.pack.MyClass.addValues";



Java method :

package com.own.pack;

public class MyClass {

public static String addValues( String c1, String c2)
{
return (c1+c2);
}
}

I am getting the below exception :

Text:CHARACTER:The Java method could not be found

Even if I have placed the Myutil.jar file in Message broker runtime directory C:\Program Files\ibm\MQSI\8.0.0.2\classes\ but getting the same exception.

Any help would be really appreciated.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Oct 07, 2013 5:57 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Try importing the Global Cache Sample and comparing it to yours.

Perhaps your java project is not setup correctly?
_________________
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
lancelotlinc
PostPosted: Mon Oct 07, 2013 6:07 am    Post subject: Reply with quote

Jedi Knight

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

Your signature is not correct.

Code:
myproc( IN P1 CHARACTER, OUT P2 CHARACTER)


But you are passing in two strings where the second string is an OUT value.

In addition, you really need to wrap your head around where this jar should go. Did you mean 'shared-classes' rather than 'classes' ?
_________________
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
rock33
PostPosted: Mon Oct 07, 2013 6:25 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Thanks a lot lancelotlinc for spotting the minor bug.

Its is working fine.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Oct 07, 2013 6:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
Did you mean 'shared-classes' rather than 'classes' ?


DO NOT PUT ANYTHING IN THE CLASSES DIRECTORY.
Back to top
View user's profile Send private message
rock33
PostPosted: Mon Oct 07, 2013 6:54 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Thanks mqjeff.

I have placed .jar file into shared-classes only.
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 » Call a java function from esql code in WMB v8.0
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.