Author |
Message
|
Android 23 |
Posted: Tue Aug 01, 2017 11:31 pm Post subject: Error while calling Java Method using esql |
|
|
Apprentice
Joined: 27 Mar 2017 Posts: 38
|
Hello Guys,
I'm trying to call java class using esql through compute node. And i have created procedure to call it .
Java program is working fine .when i call the java in esql. It is showing class not found exception.
I have used Fileinput->compute->Fileoutput.
IIB Version=10.0.0.5
Below go through below code:
Esql Code:
Code: |
--DECLARE outp EXTERNAL CHARACTER '';
CREATE COMPUTE MODULE Property_File_Calling_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
--CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE EV REFERENCE TO Environment.Variables;
DECLARE outp CHARACTER '';
-- CALL GetProperties(Environment,outp);
CALL propcallfile(outp) ;
-- INTO EV.RESULT;
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
CREATE FUNCTION propcallfile(IN outp REFERENCE)
-- RETURNS CHARACTER
LANGUAGE JAVA
-- EXTERNAL NAME "com.ibm.broker.SampProject.mm";
EXTERNAL NAME "com.ibm.broker.pro.Prop.getdetails"; |
Java Code
Code: |
package com.ibm.broker.pro;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class Prop {
public static void getdetails(String file) {
Properties prop = new Properties();
// System.out.println();
//String file = "D:/Task/Property_file/Property.properties";
System.out.println(file);
File f = new File(file);
System.out.println(f);
try {
FileInputStream infile = new FileInputStream(f);
System.out.println(infile);
prop.load(infile);
System.out.println("file");
System.out.println(prop.getProperty("dbpassword"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//return true;
}
public static void main(String[] args){
// // ReadProperty(null);
// TODO Auto-generated method stub
// ReadProperty();
System.out.println("Started");
getdetails("D://Task//Property_file//Property.properties");
}
}
|
Error while deploying:
Quote: |
Begin running task [Deploying [Property_File] to integration server [default]]
BIP2087E: Integration node 'esb_broker' 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: (.propcallfile, 1.2) : An error occurred when trying to resolve the Java class or method 'com.ibm.broker.SampProject.mm' which is referred to by the routine 'propcallfile'.
Further messages are generated that explain the error in more detail.
Correct the syntax of your Java expression in node '.propcallfile', around line and column '1.2', then redeploy the message flow.
BIP2943E: The Java Method 'com.ibm.broker.SampProject.mm' could not be found as its containing class could not be found in the deployed bar file or in the 'workpath/shared-classes/' directory.
The specified Java Method 'com.ibm.broker.SampProject.mm' belongs to a class that could not be found in the deployed bar file or the 'workpath/shared-classes/' directory. Ensure that the fully qualified name of the method is correct and that its containing class or jar file is in the deployed bar file or in the 'workpath/shared-classes/' directory.
Examine and correct the SQL program.
The task was unsuccessful: The deployment was unsuccessful. Check error messages above for explanation.
|
Please go through it and suggest me where did i make mistake.
Thanks & Regards
Android 23 |
|
Back to top |
|
 |
zpat |
Posted: Tue Aug 01, 2017 11:56 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Quote: |
-- EXTERNAL NAME "com.ibm.broker.SampProject.mm";
EXTERNAL NAME "com.ibm.broker.pro.Prop.getdetails";
|
It's looking for the former name, suggesting you didn't save the updated source code after you commented it out, or you need to rebuild your bar file. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
Android 23 |
Posted: Wed Aug 02, 2017 12:11 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2017 Posts: 38
|
zpat wrote: |
Quote: |
-- EXTERNAL NAME "com.ibm.broker.SampProject.mm";
EXTERNAL NAME "com.ibm.broker.pro.Prop.getdetails";
|
It's looking for the former name, suggesting you didn't save the updated source code after you commented it out, or you need to rebuild your bar file. |
I have saved it and rebuild the bar .
Tried this two things:
1)I have added jar file to bar file.
2)Added java program as Managed Included projects.
Still this is error is not resolved.
Thanks & Regards |
|
Back to top |
|
 |
zpat |
Posted: Wed Aug 02, 2017 1:36 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
It's looking for a name that you are no longer using. So remove all trace of that name. Try cleaning your workspace. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
Android 23 |
Posted: Wed Aug 02, 2017 3:34 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2017 Posts: 38
|
zpat wrote: |
It's looking for a name that you are no longer using. So remove all trace of that name. Try cleaning your workspace. |
Thanks zpat
It worked i created new messageflow with different name and java file.And i included Property as external character in esql.
It didnt import jar file to it.Actually, I included java app in the application.
Thanks & Regards
Android 23 |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 02, 2017 4:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Android 23 wrote: |
zpat wrote: |
It's looking for a name that you are no longer using. So remove all trace of that name. Try cleaning your workspace. |
Thanks zpat
It worked i created new messageflow with different name and java file.And i included Property as external character in esql.
It didnt import jar file to it.Actually, I included java app in the application.
Thanks & Regards
Android 23 |
Just as an aside, you should not be using a file to store passwords.
Look at configurable services and the use of mqsisetdbparms...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|