× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




All,

I this is my first attempt at calling Java from RPG and I am about to pull my hair out.
I have a .jar for from a third party vendor that I am trying to communicate with named CGProCLI.jar.
I tried my own directory at first but the .jar currently resides in the QIBM/UserData/Java400/ext directory and it’s my understanding that I don’t even need to set the class path to there as it’s a default, but I set the classpath anyway.
I have spent quite some time reading and looking at various examples on the web and even created my own java program on the 400 and compiled it in above directory and got it to work. Every time I run this I get the dreaded java.lang.NoClassDefFoundError error. I have included my prototype, RPG, the java code from the third party and my errors. I am sure this is something really silly on my part, but any help would be appreciated.

Thanks, Jon


* Connect method
D CGConnect S O CLASS(*JAVA:'CGProCLI')
* Connect method
D new_CGConnect...
D PR Like(CGConnect)
D ExtProc(*JAVA:'CGProCLI'
D :*CONSTRUCTOR)
D CGConnect2...
D PR
D ExtProc(*JAVA:'CGProCLI'
D :'CGProCLI')
* method parameters
D host O Class(*JAVA:'java.lang.String')
D Const
D port O Class(*JAVA:'java.lang.String')
D Const
D login O Class(*JAVA:'java.lang.String')
D Const
D password O Class(*JAVA:'java.lang.String')
D Const


And finally the code:


D Conn S like(CGConnect)
*
/Free
shost = newString(%trim(host));
sport = newString(%trim(port));
slogin = newString(%trim(login));
spassword = newString(%trim(password));

Conn = new_CGConnect(); This is where it blows.

RtnCode = CGConnect2(Conn:sHost:sPort+
sLogin:sPassword);

/End-Free

The java code:

public CGProCLI(String host,int port,String user,String password) throws CGProException {
openStream(host,port);
connect(user,password);
}

And the ever too popular error:

Cause . . . . . : RPG procedure CG0001 in program GDSBILLBLD/CG0001 received
Java exception "java.lang.NoClassDefFoundError: CGProCLI" when calling
method "<init>" with signature "()V" in class "CGProCLI".

When I run:

echo $CLASSPATH | tr ":" "\n"

I get:
'.
/QIBM/UserData/Java400/ext/CGProCLI.jar
_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.