on 2007 Dec 24 12:37 PM
Hi,
My question is how to call an RFC from a bean Class (stateless Session Bean). I have followed a link and wrote a following class :
public class Bapi1
{
public static void main(String args[])throws ApplicationFaultException, SystemFaultException
{
String aMonth[] = null;
String aMonthVal[] = null;
JCO.Client jcoclient = null;
Yfunc001_Output output = null;
try {
jcoclient = JCO.createClient("Client","Username","Password","Lang","SAP Application System"," SAP System Number");
try {
jcoclient.connect();
System.out.println(""+ jcoclient.getASHost()+ jcoclient.getClient()+ jcoclient.getLanguage()+ jcoclient.getSystemNumber()jcoclient.getUser()jcoclient.isValid());
} catch (RuntimeException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
e.printStackTrace();
}
Yfunc001_Input input = new Yfunc001_Input();
Graph_PortType mytype = new Graph_PortType();
mytype.messageSpecifier.setJcoClient(jcoclient);
try {
output = mytype.yfunc001(input);
} catch (SystemFaultException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ApplicationFaultException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
jcoclient.disconnect();
YstructType_List list = output.get_as_listItab();
int listsize = list.size();
for (int i = 0; i < listsize; i++) {
YstructType elem = list.getYstructType(i);
aMonth<i> = elem.getMth();
aMonthVal<i> = elem.getMval();
}
}
}
When I try to Execute this class I get the following Exception
java.lang.NoClassDefFoundError
* at com.sap.mw.jco.MiddlewareJRfc$Client.connect(MiddlewareJRfc.java:882)*
* at com.sap.mw.jco.JCO$Client.connect(JCO.java:3159)*
* at com.ltil.fusionejb.Bapi1.main(Bapi1.java:32)*
Exception in thread "main"
I get an Error on Line : jcoclient.connect();
What All libraries I need to install? Please List down the Steps if possible. Points with be awarded...
Thanks,
Prasanna.
Hi,
Add the following jar to the classpath,
<Drive>:/usr/sap/<SID>/JC00/j2ee/cluster/server0/bin/ext/com.sap.mw.jco/jrfc.jar
Hope this helps in solving the issue !
Regards,
Srinivasan T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
11 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.