cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Calling Problem in J2EE

former_member187444
Participant
0 Kudos

Hi Friends,

I can call a web service in my java application. But if i try to call <b>exactly same code</b> in J2EE application (in Netweaver or Tomcat), First<b> I got java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [sapjcorfc (Not found in java.library.path)]. java.library.path [/opt/IBMJava2-amd64-142/jre/bin:/opt/IBMJava2-amd64-142/jre/bin:/opt/IBMJava2-amd64-142/jre/bin:/opt/IBMJava2-amd64-142/jre/bin/j9vm:/opt/IBMJava2-amd64-142/jre/bin:/usr/sap/FND/DVEBMGS00/exe:/usr/sap/FND/DVEBMGS00/exe:/usr/sap/FND/DVEBMGS00/exe:/tmp/sapinst_exe.10865.1173958600:/usr/sap/FND/SYS/exe/run:/oracle/client/10x_64/instantclient:/usr/lib:/usr/sap/FND/DVEBMGS00/j2ee/os_libs:/usr/sap/FND/DVEBMGS00/exe:/usr/sap/FND/DVEBMGS00/exe:/usr/sap/FND/DVEBMGS00/exe:/usr/sap/FND/SYS/exe/run:/oracle/client/10x_64/instantclient]

</b>, and i i refresh page i got

<b> java.lang.NoClassDefFoundError: com.sap.mw.jco.JCO</b> Error...

Why exactly same code run in java but doesnt run in j2ee???

My Code is blow.

Thanks For Your Helps


try {
            JCO.Client client = JCO.createClient("800","USER","PASS","en","fitides","00");
            client.connect();
            System.out.println(client.getAttributes());
            JCO.Repository mRepository;
            mRepository = new JCO.Repository("FIT", client);
            JCO.Table codes = null;
            JCO.Function function = null;
            IFunctionTemplate ft = mRepository.getFunctionTemplate("YIDO_ISKELE_LIST");
            function = ft.getFunction();
            client.execute(function);
            codes = function.getTableParameterList().getTable("T_ISKELE");
            System.out.println("ROWS :"+codes.getNumRows());
            for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                codes.setRow(i);
                System.out.println("KOD :"+codes.getString(1) +" - " + codes.getString(2));
                System.out.println("ddd");
            }
            client.disconnect();
        } catch(Exception ex) {
            ex.getMessage();
        }

Accepted Solutions (1)

Accepted Solutions (1)

former_member187444
Participant
0 Kudos

I have solved this problem in tomcat. How?

I have copy sapjac.jar and sarprfc.dll under to tomcat/common/lib and tomcat runs succesfully.

But how can i run in portal? Where do i copy the this files?

Thanks

prashil
Advisor
Advisor
0 Kudos

Hi Eray,

Congratulation!!! You got the solution!!!

The applications in Portal resides @ X:\usr\sap[SID]\JC00\j2ee\cluster\server0\apps\sap.com

Find your application there inside your application there will a WEB_INF directory.

Inside it there will be a folder named "classes" at this level create a folder named "lib" insert all your related lib files there and then after restarting the server you can check whether your problem is solved or not.

Let me know if the problem still exists!!!

Regards,

Prashil

former_member187444
Participant
0 Kudos

Hi Prashil;

Thank you so much.. I did also in SAP Portal. I have copied these files and it is ok!

Best Regards

Answers (1)

Answers (1)

prashil
Advisor
Advisor
0 Kudos

Hi Eray,

Is it happening to only this application?

Since it seems error related to the lib files not found. Please set your enviorment variables properly, check your classpath and required library files are there in the given path.

Let me know if the problem exist!!!!

Regards,

Prashil