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 » Problems with calling a Java Method in ESQL

Post new topic  Reply to topic
 Problems with calling a Java Method in ESQL « View previous topic :: View next topic » 
Author Message
kiran_mvr
PostPosted: Mon Apr 04, 2005 8:31 am    Post subject: Problems with calling a Java Method in ESQL Reply with quote

Apprentice

Joined: 12 Dec 2004
Posts: 35

Hai ..
I tried to call a Java Method using ESQL . its of this sort..

CALL DBInsert() INTO insertStatus;

CREATE PROCEDURE DBInsert()
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "Insert.FileReadAndDBInsert";

Insert is the java program name,FileReadAndDBInsert is the method in it.
I specifed the location of the Java file in classpath also. But iam getting the
following ERRORS

Error:The following error occurred during execution of an Java Method call.
Error:Java Exception calling CallStaticObjectMethodA.
Error:java.lang.NoClassDefFoundError: java/sql/Savepoint

PLZ help me with this!! very urgent...
_________________
Kiran_manny
Back to top
View user's profile Send private message
waugh
PostPosted: Mon Apr 04, 2005 10:00 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 225

Is it on windows box?
did you restart the box after you changed the classpath?

i am getting similar error.

i rebooted the server and i can run the program from command prompt.( that means its in the classpath). But broker complains class not found when deployed.

exact error:
-------------
( VENT.TESTER ) The Java Method 'Simple.addtwoints' could not be found as its containing class could not be found in the broker classpath

The specified Java Method 'Simple.addtwoints' belongs to a class that could not be found in the broker classpath. Ensure that the fully qualified name of the method is correct and that its containing class or jar file is in the broker classpath.
------------------------------------------------------
Procedure Definiton in ESQL:

CREATE PROCEDURE AddTwoIntegers(IN A INTEGER, IN B INTEGER, INOUT C INTEGER)
RETURNS INTEGER
LANGUAGE JAVA
EXTERNAL NAME "Simple.addtwoints";
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 04, 2005 11:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

waugh wrote:
Ensure that the fully qualified name of the method is correct and that its containing class or jar file is in the broker classpath.


My emphasis.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
waugh
PostPosted: Mon Apr 04, 2005 12:19 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 225

Jeff,

path to that class "C:\MQutils" was added to the classpath variable as per the documentation. restarted windows, broker. i can run that program from any directory on windows command prompt. From this i assume path is set correctly.

Simple is the java class name, addtwoints is the method name.

Java CODE:

public class Simple
{

public static int addtwoints(int A , int B, int C)
{
C = A + B;
//System.out.println("total is " + C);
return C;
}

public Simple()
{
super();
}


public static void main ( String[] aArguments )
{
Simple vSimple = new Simple();
vSimple.addtwoints(1, 2, 0);
}
};
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 04, 2005 2:32 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'll play with it myself a little later this evening, and get back to you.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kiran_mvr
PostPosted: Mon Apr 04, 2005 2:40 pm    Post subject: error with calling a method in ESQL Reply with quote

Apprentice

Joined: 12 Dec 2004
Posts: 35

Hai ,,

as you said i verified the class path and rectified it.Now the flow is working without errors but its catching some exceptions of this sort..

Exception: java.lang.SecurityException: Prohibited package name: java.sql

and iam unable to get any data in to my table which it should insert.

what shall i do now??

please guide me on this issue..

bye...
_________________
Kiran_manny
Back to top
View user's profile Send private message
kiran_mvr
PostPosted: Mon Apr 04, 2005 2:44 pm    Post subject: Problems with calling a Java Method in ESQL Reply with quote

Apprentice

Joined: 12 Dec 2004
Posts: 35

Hai

if anyone willing to see the program i can send it.. so that i can rectifiy my errors.

bye
kiran_manny
_________________
Kiran_manny
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 04, 2005 4:19 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Waugh -
I tried it. I didn't have my method signature right... I guess that using Integers in ESQL doesn't match with ints in Java.

I'm not in the mood right now to reboot my machine to pick up the changes to the class I made.

kiran_mvr -
I don't think you can make database calls from Java external procedures. Doing so runs the same risk of mangling the broker's internal transaction handling that calling out to jdbc from custom plug-ins does. And it's strongly discouraged to do so from custom plug-ins.

BUT THAT MIGHT NOT BE THE PROBLEM.

Try your java from a standalone test frame, like JUnit.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Mon Apr 04, 2005 4:29 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
I guess that using Integers in ESQL doesn't match with ints in Java

Nope:
Code:
ESQL data types    Java IN data types    Java INOUT and OUT data types
INTEGER, INT         java.lang.Long          java.lang.Long []

Quote:
I don't think you can make database calls from Java external procedures

Not quite true:
Quote:
Only JDBC type 4 database connections are permitted

But don't ask me what a type 4 connection is, becasue I've got no idea.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 04, 2005 5:24 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

EddieA wrote:
But don't ask me what a type 4 connection is, becasue I've got no idea.


I believe it's a "100% pure java" jdbc driver. Like the Java MQ Client API.

Edit: And, yes, I knew that it was documented how types matched between Java and ESQL. I just didn't bother to check before hand.
_________________
I am *not* the model of the modern major general.
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 » Problems with calling a Java Method in 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.