Note that there are some explanatory texts on larger screens.

plurals
  1. PORPG calling Java, java.lang.NoClassDefFoundError
    primarykey
    data
    text
    <p>My aim is to call a Web Service from Java, initiated from a RPG function. (I know, its long way around, but it is what we need)</p> <p>I have created a <code>/JavaLib</code> folder on the AS400, and copied all our needed External Jars we need.</p> <p>Create a Java class with a static method <code>WebServiceCaller.Call()</code> to call a Web Service. When ever I run my RPG program everything is fine unto the RPG calls this method.</p> <p>I get a Java exception:</p> <blockquote> <p>Message . . . . : Java exception received when calling Java method (C G D F).<br> Cause . . . . . : RPG procedure WEBSERCALR in program WAL60326/WEBSERCALR received Java exception "java.lang.NoClassDefFoundError:<br> javax.xml.rpc.ServiceException" when calling method "Call" with signature "(LwebService.Input;)LwebService.Output;" in class<br> "webService.WebServiceCaller". </p> </blockquote> <p>CLASSPATH variable:</p> <blockquote> <p>/JavaLib:/home/WAL60326/WebServiceCaller</p> </blockquote> <p>So I believe my RPG and Java Class is fine, and I believe I have setup my CLASSPATH variable right. Not sure what else there is to check. </p> <hr> <h2>Update</h2> <p>So the jar file I need is <code>jaxrpc.jar</code> I have checked; it does exists in my <code>/JavaLib</code>. Was able to check my Java version on the AS400 <code>java version "1.5.0"</code>. And follow these <a href="http://itknowledgeexchange.techtarget.com/itanswers/how-can-be-check-os-version-in-as400/" rel="nofollow">instructions</a> to check that my OS is V6R1.</p> <p>Could it be my Java version that is out of date, for this Jar file to be loaded/work? Is that even a possibility?</p> <hr> <h2>Edit</h2> <p>Here is my source code:</p> <p>Java: WebServiceCaller.Java</p> <pre><code>package webService; import java.rmi.RemoteException; import stocklistGetBids.GetBidsProxy; public class WebServiceCaller { public static Output Call(Input in) { // Input Class, is just a way to hold all the input together Output out = null; // Output Class, holds all the output together try { GetBidsProxy getBidsProxy = new GetBidsProxy(); // GetBidsProxy generated by Eclipse out = new Output(getBidsProxy.getBids(in.LogKey, in.Id)); } catch (RemoteException e) { e.printStackTrace(); out = new Output("ERR"); } return out; } } </code></pre> <p>Take note that the GetBidsProxy class in generated by Eclipse. And the Java side works well on my Windows Machine. Just not on the AS400 Machine.</p> <p>RPG: WEBSERCALR.RPGLE</p> <pre><code> H DFTACTGRP(*NO) H thread(*serialize) D WebsercalInput DS D ReturnCode 7A D LogKey 20A D ID 20A D jString S O CLASS(*JAVA:'java.lang.String') D jLogKey S O CLASS(*JAVA:'java.lang.String') D jID S O CLASS(*JAVA:'java.lang.String') D Input S O CLASS(*JAVA:'webService.Input') D Output S O CLASS(*JAVA:'webService.Output') D new_Input PR O EXTPROC(*JAVA: D 'webService.Input': D *CONSTRUCTOR) D LogKey like(jString) D ID like(jString) D new_String PR O EXTPROC(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D bytes 30A CONST VARYING D Call PR like(Output) D EXTPROC(*JAVA: D 'webService.WebServiceCaller': D 'Call') D STATIC D in like(Input) D getReturnStat PR O EXTPROC(*JAVA: D 'webService.Output': D 'getReturnedStatus') D CLASS(*JAVA:'java.lang.String') D getBytes PR 65535A VARYING D EXTPROC(*JAVA: D 'java.lang.String': D 'getBytes') C *ENTRY PLIST C PARM WebsercalInput /free jLogKey = new_String(LogKey); jID = new_String(ID); Input = new_Input(jLogKey:jID); Output = Call(Input); jString = getReturnStat(Output); ReturnCode = getBytes(jString); return; /End-Free </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload