Author |
Message
|
Roothless |
Posted: Mon Jun 25, 2007 12:13 am Post subject: Calling Java Class from Compute Node: Class not found except |
|
|
 Apprentice
Joined: 11 Dec 2006 Posts: 26
|
Hi, i am trying to call Java method from Compute Node.I have done the following steps in this case.
My Java Class as follows:
import java.io.*;
public class TestJavaClass
{
public static String getNodeName()
{
return "MyUserDefinedNode";
}
}
I as using the following ESQL in Compute node:
CREATE PROCEDURE myProc()RETURNS CHARACTER LANGUAGE JAVA EXTERNAL NAME "TestJavaClass.getNodeName()";
SET Environment.Variables.Name = myProc();
I created Jar file from the class file and placed on the path
C:\Documents and Settings\All Users\Application Data\IBM\MQSI\shared-classes
restarted the broker, started the Toolkit with -clean option, But i am getting the Class not found exception. Is there anyway out here?
Please help me.
Thanks in Advance _________________ MQ Toddler |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Mon Jun 25, 2007 3:59 am Post subject: Re: Calling Java Class from Compute Node: Class not found ex |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
HI, I see here one error.
Try this ( without '()' ):
Code: |
CREATE PROCEDURE myProc()RETURNS CHARACTER LANGUAGE JAVA EXTERNAL NAME "TestJavaClass.getNodeName"; |
PS. Why don't you add this jar directly to bar ?
You don't have to put jar in shared-classes dir. _________________ Marcin |
|
Back to top |
|
 |
Roothless |
Posted: Mon Jun 25, 2007 4:24 am Post subject: |
|
|
 Apprentice
Joined: 11 Dec 2006 Posts: 26
|
Hi, I tried both the options i.e adding the JAR file to the Bar file and placing the JAR file in shared class directory. But no use of that. Am i missing anything else here. _________________ MQ Toddler |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Mon Jun 25, 2007 4:34 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Roothless wrote: |
Hi, I tried both the options i.e adding the JAR file to the Bar file and placing the JAR file in shared class directory. But no use of that. Am i missing anything else here. |
Show entire error message. _________________ Marcin |
|
Back to top |
|
 |
vgollakota |
Posted: Mon Jun 25, 2007 4:54 am Post subject: Re: Calling Java Class from Compute Node: Class not found ex |
|
|
Apprentice
Joined: 19 Feb 2007 Posts: 37
|
Roothless wrote: |
Hi, i am trying to call Java method from Compute Node.I have done the following steps in this case.
My Java Class as follows:
import java.io.*;
public class TestJavaClass
{
public static String getNodeName()
{
return "MyUserDefinedNode";
}
}
I as using the following ESQL in Compute node:
CREATE PROCEDURE myProc()RETURNS CHARACTER LANGUAGE JAVA EXTERNAL NAME "TestJavaClass.getNodeName()";
SET Environment.Variables.Name = myProc();
I created Jar file from the class file and placed on the path
C:\Documents and Settings\All Users\Application Data\IBM\MQSI\shared-classes
restarted the broker, started the Toolkit with -clean option, But i am getting the Class not found exception. Is there anyway out here?
Please help me.
Thanks in Advance |
Hai Roothless,
Did you include this jar file into your java buildpath..???
And after that if you still have an exception , try out with this debug option ,
here are the two commands..!
mqsichangeproperties <Broker Name> -e <Execution Group Name>
-o ComIbmJVMManager -n jvmDebugPort -v <Port Number>
give the port number like 11448 or so..!
mqsireload <Broker Name> -e <Execution Group Name> _________________ G.VANDANA |
|
Back to top |
|
 |
Roothless |
Posted: Mon Jun 25, 2007 7:48 pm Post subject: |
|
|
 Apprentice
Joined: 11 Dec 2006 Posts: 26
|
Hi Vandana,
Where is java Build path and How to add my jar file to Java Build path. I really dont know please explain me in detail.
Thanks _________________ MQ Toddler |
|
Back to top |
|
 |
JohnMichael |
Posted: Tue Jun 26, 2007 1:03 am Post subject: |
|
|
 Acolyte
Joined: 28 Feb 2007 Posts: 55
|
Hai Roothless,
When you create a java class file for your Java Compute Node , I think you know that a java project would be created and the the java source would be in that project. If you right click on that project where your java class is present, go properties...
Suppose your java file is Hello.java and in the Project HelloProject
Now Right Click on HelloProject ,go to properties ...There you would find java buildpath.select this and then select the 'libraries' tab. There u would have an option Add External JARs, you add the supporting jar file then say 'OK'.
As you have already said that you have placed the jar file in sharedclasses ,even for runtime its should not be a problem now.
I wish you got it. If any clarifications... respond me again... |
|
Back to top |
|
 |
mrgate |
Posted: Tue Jun 26, 2007 1:29 am Post subject: Re: Calling Java Class from Compute Node: Class not found ex |
|
|
 Centurion
Joined: 28 Feb 2007 Posts: 141 Location: India
|
vgollakota wrote: |
Roothless wrote: |
Hi, i am trying to call Java method from Compute Node.I have done the following steps in this case.
My Java Class as follows:
import java.io.*;
public class TestJavaClass
{
public static String getNodeName()
{
return "MyUserDefinedNode";
}
}
I as using the following ESQL in Compute node:
CREATE PROCEDURE myProc()RETURNS CHARACTER LANGUAGE JAVA EXTERNAL NAME "TestJavaClass.getNodeName()";
SET Environment.Variables.Name = myProc();
I created Jar file from the class file and placed on the path
C:\Documents and Settings\All Users\Application Data\IBM\MQSI\shared-classes
restarted the broker, started the Toolkit with -clean option, But i am getting the Class not found exception. Is there anyway out here?
Please help me.
Thanks in Advance |
Hai Roothless,
Did you include this jar file into your java buildpath..???
And after that if you still have an exception , try out with this debug option ,
here are the two commands..!
mqsichangeproperties <Broker Name> -e <Execution Group Name>
-o ComIbmJVMManager -n jvmDebugPort -v <Port Number>
give the port number like 11448 or so..!
mqsireload <Broker Name> -e <Execution Group Name> |
Hi vandana,
I too have worked on the same task where Roothless have worked and have included the jar file in java build path but still I am getting exception during run time saying that "The java method could not be found" can you help me in solving this. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue Jun 26, 2007 1:32 am Post subject: Re: Calling Java Class from Compute Node: Class not found ex |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
rock wrote: |
Hi vandana,
I too have worked on the same task where Roothless have worked and have included the jar file in java build path but still I am getting exception during run time saying that "The java method could not be found" can you help me in solving this. |
Could you open new thread or update existing one and show ESQL code and entire error message. _________________ Marcin |
|
Back to top |
|
 |
WBI_User21 |
Posted: Tue Jun 26, 2007 1:39 am Post subject: |
|
|
 Voyager
Joined: 12 Jun 2007 Posts: 98
|
Try changing Procedure to function...
not sure Broker can map esql proc with return type to java routine.. |
|
Back to top |
|
 |
mrgate |
Posted: Tue Jun 26, 2007 2:26 am Post subject: |
|
|
 Centurion
Joined: 28 Feb 2007 Posts: 141 Location: India
|
Hey guys,
All the replies except marcin.kasinski are of no use. what marcin.kasinski said in his first reply is correct, whenever we are calling a java method dynamically in esql we should not include braces in the external name |
|
Back to top |
|
 |
ingchristianreyes |
Posted: Fri Aug 21, 2009 2:17 pm Post subject: |
|
|
Newbie
Joined: 21 Aug 2009 Posts: 4
|
Hi all, i have the same trouble in a mapping node, i am trying to use a java static method for load a properties file, this java methos is called from the mapping and return a string.
I am including the jar file into the bar and also I am trying to add the jar to the Classpath system variable, but i still receive a Java Class Not Found.
Does exist some restriction or aditional step for use a Java Class in WMB?
thanks |
|
Back to top |
|
 |
|