|
From: rvrratjon@xxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> Subject: RE: Calling Java from RPG> Date: Thu, 7 Feb 2008 21:20:45 +0000> > > For some reason, the resot of my email got cut off, here is the rest.> > * 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> > From: rvrratjon@xxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> Subject: Calling Java from RPG> Date: Thu, 7 Feb 2008 21:07:09 +0000> > > 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> -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list> To post a message email: RPG400-L@xxxxxxxxxxxx> To subscribe, unsubscribe, or change list options,> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l> or email: RPG400-L-request@xxxxxxxxxxxx> Before posting, please take a moment to review the archives> at http://archive.midrange.com/rpg400-l.> > _________________________________________________________________> Shed those extra pounds with MSN and The Biggest Loser!> http://biggestloser.msn.com/> -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list> To post a message email: RPG400-L@xxxxxxxxxxxx> To subscribe, unsubscribe, or change list options,> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l> or email: RPG400-L-request@xxxxxxxxxxxx> Before posting, please take a moment to review the archives> at http://archive.midrange.com/rpg400-l.>_________________________________________________________________
As an Amazon Associate we earn from qualifying purchases.
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.