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 » The Java method could not be found

Post new topic  Reply to topic
 The Java method could not be found « View previous topic :: View next topic » 
Author Message
Rahul999
PostPosted: Wed Feb 17, 2010 4:09 am    Post subject: The Java method could not be found Reply with quote

Centurion

Joined: 14 Mar 2007
Posts: 134

Hi All,

I am trying to call a Java Function from an ESQL procedure.

I am calling the function correctly but still getting the "Java Method not found" error, here is the code I am using to call the function.

Quote:

CREATE COMPUTE MODULE Java_Socket_Compute
DECLARE Host EXTERNAL CHARACTER 'localhost';
DECLARE Port EXTERNAL INTEGER 8888;
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE reqStr CHAR CAST(ASBITSTREAM(InputRoot.XMLNSC.*[1] OPTIONS FolderBitStream) as CHARACTER CCSID 1208);
SET OutputRoot.BLOB.BLOB = InvokeSocket(Host, Port, reqStr);
RETURN TRUE;
END;
END MODULE;

CREATE FUNCTION InvokeSocket(IN host CHARACTER, IN port INT, IN req CHARACTER)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.xyz.abc.mw.Common.InvokeSocket";


And, I am creating a class with the name Common with the Method InvokeSocket inside it.
Please see some part of the class here -



package com.xyz.abc.mw;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class Common
{


public static byte[] InvokeSocket(String host, int port, String Request)
byte[] a = null;
--------- some line of code -----------------
return a;


I dont see any problem here but still I am getting the below error

Quote:
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlRoutine.cpp
Line:INTEGER:1153
Function:CHARACTER:SqlRoutine::resolveExternalJavaParameters
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:Java_Socket#FCMComposite_1_2
Label:CHARACTER:Java_Socket.Compute
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:3202
Text:CHARACTER:An error occured whilst trying to locate a Java Class / method
Insert
Type:INTEGER:5
Text:CHARACTER:.InvokeSocket
Insert
Type:INTEGER:5
Text:CHARACTER:1.12
Insert
Type:INTEGER:5
Text:CHARACTER:com.xyz.abc.mw.Common.InvokeSocket
Insert
Type:INTEGER:5
Text:CHARACTER:InvokeSocket
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlExternalJava.cpp
Line:INTEGER:1102
Function:CHARACTER:ESQL2JavaMethodResolver::decodeReturnStatus
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2946
Text:CHARACTER:The Java method could not be found
Insert
Type:INTEGER:5
Text:CHARACTER:com.xyz.abc.mw.Common.InvokeSocket


I have referenced the Java class project from the message flow project. is there anything els(like classpath) I need to configure? I am not able to get any idea about this.

Any help would be highly appreciated.

Regards,
_________________
"For all your days be prepared, and meet them ever alike.
When you are the anvil, bear - when you are the hammer, strike."
- Edwin Markham
Back to top
View user's profile Send private message Send e-mail Visit poster's website
WMBDEV1
PostPosted: Wed Feb 17, 2010 5:06 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Have you tried changing the type of the port variable in the java code to be a Long object rather than the int primitive?

That should help.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed Feb 17, 2010 5:09 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

As an aside, and without knowing exactly what you are doing, would it be worth considering using the TCP nodes that come with broker rather than rolling your own?

Just a thought.
Back to top
View user's profile Send private message
Rahul999
PostPosted: Thu Feb 18, 2010 12:02 am    Post subject: Reply with quote

Centurion

Joined: 14 Mar 2007
Posts: 134

Hi WmbDEV1,

.
Quote:
Have you tried changing the type of the port variable in the java code to be a Long object rather than the int primitive?

That should help.


actually i did that hit and trial of passing the port variable as Long before your replied and it worked

but the credit goes to you only to give the solution for this issue

Thanks
_________________
"For all your days be prepared, and meet them ever alike.
When you are the anvil, bear - when you are the hammer, strike."
- Edwin Markham
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SANTYP
PostPosted: Thu Aug 26, 2010 8:15 pm    Post subject: Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

Rahul999 wrote:
Hi WmbDEV1,

.
Quote:
Have you tried changing the type of the port variable in the java code to be a Long object rather than the int primitive?

That should help.



"An error occured whilst trying to locate a Java Class / method"


actually i did that hit and trial of passing the port variable as Long before your replied and it worked

but the credit goes to you only to give the solution for this issue

Thanks


Hi Guys,
I am also faced simliar problem..
I tried to change the INT to LONG but not clue from the prog..
Still getting the below error..
can any one help me out in this regard...
Plzzzz....
Back to top
View user's profile Send private message
Kishore p
PostPosted: Thu Jun 30, 2016 7:02 am    Post subject: Reply with quote

Newbie

Joined: 23 Mar 2016
Posts: 5

Hi guys,

I too facing same problem , Please help me to solve this issue

Thanks in advance
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 » The Java method could not be found
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.