Extended-SQL говорит: «Не удалось найти метод Java» - PullRequest
0 голосов
/ 20 марта 2019

Я новичок в IIB, а также стековый поток и просто играю с некоторыми потоками. Я получаю ошибку The Java method 'MQDepth.getMQDepth' could not be found. Я сослался на здесь , который говорит о двух методах развертывания jar, (i) Добавьте файл JAR в файл BAR (ii) Сохраните файл JAR в любом из следующие места. Я не смог найти сайт, который объясняет, как я могу добавить банку в панель, поэтому я выбрал опцию (ii) . Ниже объясняется, что я сделал и какую ошибку я получаю. Любая помощь будет оценена.

Я создал поток:
«Узел уведомления TimeOut» установлен на автоматический (скажем, 1 минута) → Вычислительный узел → Выходной узел MQ

Что я хочу сделать:
Автоматически определять CurrDepth очереди и генерировать XML на данный момент (это будет изменено на почту с дополнительными условиями). Код (esql) вызывает пользовательскую процедуру (GetCurrDepth).

Код вычислительного узла:

DECLARE queueManager CHAR;
DECLARE queueName CHAR;
DECLARE queueDepth INT;

SET queueManager = 'DDMQBKD10';
SET queueName = 'INPUT';

CALL GetCurrDepth(queueManager, queueName, queueDepth);

IF queueDepth > 0 THEN
    SET OutputRoot.XMLNSC.Report.QManager = queueManager;
    SET OutputRoot.XMLNSC.Report.QName = queueName;
    SET OutputRoot.XMLNSC.Report.QDepth = queueDepth;
END IF;

Вызов GetCurrDepth:

CREATE PROCEDURE GetCurrDepth(IN qMgr  CHARACTER
                             ,IN qName CHARACTER
                             ,OUT qDepth INTEGER)
LANGUAGE JAVA 
EXTERNAL NAME "MQDepth.getMQDepth";

GetCurrDepth JAVA:

import com.ibm.mq.MQException;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.MQConstants;

public class MQDepth {

    public static void getMQDepth(String QManager, String Q, Integer QDepth) throws MQException
    {

        // define the name of the QueueManager
        final String qManager = QManager;
        // and define the name of the Queue
        final String qName = Q;

            // Create a connection to the QueueManager
            MQQueueManager qMgr = new MQQueueManager(qManager);

            // Now specify the queue that we wish to open and the open options
            MQQueue queue = qMgr.accessQueue(qName, MQConstants.MQOO_INQUIRE | MQConstants.MQOO_INPUT_AS_Q_DEF, null, null, null);

            // Check the currdepth of the queue
            try {
                QDepth = queue.getCurrentDepth();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            // Close the queue
            queue.close();

            // Disconnect from the QueueManager
            qMgr.disconnect();
    }
}

JAR: Я создал JAR-файл этого JAVA и сохранил его в "C: \ ProgramData \ IBM \ MQSI \ shared-classes"

ОШИБКА:

BIP2087E: Integration node 'TESTNODE_Dipanjan' was unable to process the internal configuration message. 
The entire internal configuration message failed to be processed successfully. 
Use the messages following this message to determine the reasons for the failure. If the problem cannot be resolved after reviewing these messages, contact your IBM Support center. Enabling service trace may help determine the cause of the failure.
BIP4041E: Integration server 'default' received an administration request that encountered an exception. 
While attempting to process an administration request, an exception was encountered. No updates have been made to the configuration of the integration server. 
Review related error messages to determine why the administration request failed.
BIP3202E: (.GetCurrDepth, 1.1) : An error occurred when trying to resolve the Java class or method 'MQDepth.getMQDepth' which is referred to by the routine 'GetCurrDepth'. 
Further messages are generated that explain the error in more detail. 
Correct the syntax of your Java expression in node '.GetCurrDepth', around line and column '1.1', then redeploy the message flow.
BIP2946E: The Java method 'MQDepth.getMQDepth' could not be found 
The Java method 'MQDepth.getMQDepth' 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.
BIP2871I: The request made by user 'DESKTOP-6BQMC6G\Dipanjan' to 'deploy' the resource 'C:/Users/Dipanjan/IBM/IIBT10/workspace/GeneratedBarFiles/BigOneproject.generated.bar' of type 'BAR' on parent 'default' of type 'ExecutionGroup' has the status of 'FAILED'.

1 Ответ

0 голосов
/ 20 марта 2019

На основе Таблица сопоставления типов данных ESQL-Java , ESQL OUT INTEGER сопоставляется с Java java.lang.Long[].

«Пример 2 подпрограммы Java» в операторе CREATE PROCEDURE объясняет ваш вариант использования.

...