Author |
Message
|
ferloz |
Posted: Wed Sep 21, 2005 6:59 am Post subject: Java Procedures |
|
|
 Novice
Joined: 26 May 2005 Posts: 23
|
Hai all,
i've written a simple java code for extending the Util class in ibm.com.broker for getting the name of the broker and the name of the execution group.
The first function work correctly the second give me an deployment error also if i've restarted the W2K machine witch the broker run on.
Anyone can help me ?
follow the 2 piece of code ( ESQL & Java )
Thanks a lot in advance
Paolo
....
set ExecutionGroupName = getExecutionGroupName ();
RETURN TRUE;
END;
CREATE PROCEDURE getExecutionGroupName ()
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.Utils.getExGroupName";
....
package com.ibm.broker;
import com.ibm.broker.plugin.*;
/**
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Utils {
/*
* Returns the name of the Execution Group, which the flow is running on.
*/
public static String getExGroupName() {
String value = "error";
try {
MbNode mn = new MbNode();
MbExecutionGroup eg = mn.getExecutionGroup();
value = eg.getName();
} catch (MbException e) {
return value;
}
return value;
}
/*
* Returns the name of the broker, which the flow is running on.
*/
public static String getBrokerName() {
String value = "error";
try {
MbNode mn = new MbNode();
MbBroker mb = mn.getBroker();
value = mb.getName();
} catch (MbException e) {
return value;
}
return value;
}
} _________________ fkid |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 21, 2005 7:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's not supported to use the Plugin-API from a Java procedure.
There's been a bunch of discussion on this... "Search" is your friend. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ferloz |
Posted: Wed Sep 21, 2005 8:08 am Post subject: |
|
|
 Novice
Joined: 26 May 2005 Posts: 23
|
Thanks jefflowrey , for the post. I've already read all the items you mention, but the question is a little bit different : why the second method work and the first not ?
Probably is not correct at all to use it ... but work .
 _________________ fkid |
|
Back to top |
|
 |
mgk |
Posted: Wed Sep 21, 2005 8:39 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
Jeff is correct that this is not supported. However, if you want to find out why this does not work, then please post the rest of your esql code, your system classpath and the actual error message you are getting.
Regards, _________________ 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 |
|
 |
ferloz |
Posted: Thu Sep 22, 2005 2:05 am Post subject: |
|
|
 Novice
Joined: 26 May 2005 Posts: 23
|
Thanks for the attention.
Paolo
The complete ESQL Code
Quote: |
CREATE COMPUTE MODULE ProvaPlugin_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
declare BrokerName char ;
declare ExecutionGroupName char ;
SET OutputRoot = InputRoot;
set BrokerName = getBroker ();
set OutputLocalEnvironment.Variables.User.BrokerName = BrokerName;
set ExecutionGroupName = getExecutionGroupName ();
RETURN TRUE;
END;
CREATE PROCEDURE getExecutionGroupName ()
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.Utils.getExGroupName";
CREATE PROCEDURE getBroker ()
RETURNS CHAR
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.Utils.getBrokerName";
END MODULE;
|
The complete CLASSPATH
Quote: |
CLASSPATH=C:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar;C:\Program
Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;C:\Program Files\IBM\WebSpher
e MQ\Java\lib\ldap.jar;C:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar;C:\Pro
gram Files\IBM\WebSphere MQ\Java\lib\jndi.jar;C:\Program Files\IBM\WebSphere MQ\
Java\lib\jms.jar;C:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar;C:\Pro
gram Files\IBM\WebSphere MQ\Java\lib\fscontext.jar;C:\Program Files\IBM\WebSpher
e MQ\Java\lib\com.ibm.mq.jar;.;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;C:\PROGRA
~1\IBM\SQLLIB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;C:\PROGRA~1\I
BM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\tools\db2XTrigger.jar;C:\PROGRA~1\IBM\SQLLI
B\java\common.jar;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cisuz.jar;C:\PROGRA
~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;c:\jar\Utilities.jar
|
The errors
Quote: |
BIP2946E: The Java method 'com.ibm.broker.Utils.getExGroupName' could not be found
The Java method 'com.ibm.broker.Utils.getExGroupName' with the specified signature could not be found in the specified class. Ensure the method exists in the specified class and that it exactly matches its ESQL signature.
Examine and correct the SQL program. |
Quote: |
BIP2498E: (.ProvaPlugin_Compute.getExecutionGroupName, 1.2) : An error occured whilst trying to resolve the Java class / method 'com.ibm.broker.Utils.getExGroupName' referred to by the routine 'getExecutionGroupName'.
Further messages will explain the error in more detail.
Correct the Java error and redeploy the message flow.
|
Quote: |
BIP4121E: Syntax error in SQL statements in compute node 'ProvaPlugin.'.
The configuration of compute node ProvaPlugin. failed due to errors in the SQL expression. See the following messages for details of the error. The statement text was ' CREATE SCHEMA "" CREATE COMPUTE MODULE ProvaPlugin_Compute CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN declare BrokerName char ; declare ExecutionGroupName char ; SET OutputRoot = InputRoot; set BrokerName = getBroker (); set OutputLocalEnvironment.Variables.User.BrokerName = BrokerName; set ExecutionGroupName = getExecutionGroupName (); RETURN TRUE; END; CREATE PROCEDURE getExecutionGroupName () RETURNS CHAR LANGUAGE JAVA EXTERNAL NAME "com.ibm.broker.Utils.getExGroupName"; CREATE PROCEDURE getBroker () RETURNS CHAR LANGUAGE JAVA EXTERNAL NAME "com.ibm.broker.Utils.getBrokerName"; END MODULE; '.
The next error message will give specific details of where the error occurred in the statement text. Check the correct syntax for compute node SQL statements in the WebSphere Business Integration Message Brokers publications. Correct the statements configuring the node and redeploy the configuration. |
Quote: |
BIP4041E: Execution group 'default' received an invalid configuration message. See the following messages for details of the error.
The message broker received an invalid configuration message and has not updated its configuration. This can arise as a result of errors in the specification of either message flows or message sets which the configuration manager was unable to detect. It can also result from a message flow requiring a type of node that is not supported by the broker installation, from the broker having become out of step with the configuration database or from other applications sending extraneous messages to the broker's configuration queues (SYSTEM.BROKER.ADMIN.QUEUE & SYSTEM.BROKER.EXECUTIONGROUP.QUEUE).
Check the relevant message flow and message set definitions, check that all necessary plug-ins are installed, perform a complete redeploy of the broker's configuration and ensure that no applications are writing to the broker's configuration queues. |
Quote: |
BIP2087E: Broker WBRK_BROKER was unable to process the internal configuration message.
The entire internal configuration message failed to be processed successfully.
The internal configuration message failed to be processed, use the messages following this message to determine the reasons for the failure. |
_________________ fkid |
|
Back to top |
|
 |
javaforvivek |
Posted: Thu Sep 22, 2005 3:46 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
It's working perfectly on my machine. There is no problem with code.
W2K machine needs to be resterted when you change the system classpath.. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
ferloz |
Posted: Thu Sep 22, 2005 4:48 am Post subject: |
|
|
 Novice
Joined: 26 May 2005 Posts: 23
|
Dear javaforvivek i've did reboot several times but nothing change.
Can you suggest another thing that i'm wrong ?
What i've forget ?
i know that the computer is always right ...  _________________ fkid |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 22, 2005 4:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Either the method isn't in the class that's in the jarfile on the broker, or the method signature is wrong. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Thu Sep 22, 2005 5:54 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
I agree.
Your code worked for me too. May I suggest that the jar file may not have the path inside it to the class??
Regards. _________________ 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 |
|
 |
javaforvivek |
Posted: Thu Sep 22, 2005 8:13 pm Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
I feel the same way. Please open your jar file, and check whether the class Utils is present in the package com.ibm.broker.plugin and also whether it contains the said method or not. Good thing to do is to decompile the Utils.class to java source file and check it!!
I have created a java project in my toolkit - SampleJavaPrj, inside it, I created com.ibm.broker.plugin package, in which i wrote the Utils.java in it, then exported the project in the C:\jars\Utilities.jar file. Then I added this path to my system classpath and restarted my machine.
May be that you have followed these steps, but I have given these steps for you to cross-check. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
ferloz |
Posted: Mon Sep 26, 2005 6:45 am Post subject: [solved] Java Procedures |
|
|
 Novice
Joined: 26 May 2005 Posts: 23
|
Dear all,
thanks for the suggestions .
i've tried each one but without any succesful result.
the only one solution is to split the two functions in two different projects and adding them to the classpath ... ... really i don't know why but seem to work ...
Paolo _________________ fkid |
|
Back to top |
|
 |
bhupa_sri |
Posted: Mon Sep 26, 2005 7:34 am Post subject: |
|
|
Apprentice
Joined: 30 Dec 2004 Posts: 30 Location: India
|
Hi,
i faced same problem few days back i got the solution as u'r MB need to update with fixpack4. |
|
Back to top |
|
 |
JT |
Posted: Mon Sep 26, 2005 8:16 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Apparently he/she is at FP4 or later, if......
ferloz wrote: |
The first function work correctly |
|
|
Back to top |
|
 |
|