cancel
Showing results for 
Search instead for 
Did you mean: 

Error : com.sap.mw.jco.rfc.MiddlewareRFC / When a JCO is used to acces SAP

Former Member
0 Kudos

Hai,

I have created a JAVA program to call a SAP function. The JAVA project is in the path C:\MY Documents\. I have copied all the required jar files from the folder C:\Program Files\SAP\JDT\eclipse\plugins\ and copied to path C:\lib and then added to my project using the option add JAR files by refering the path C:\lib. When i executed the project i got a error "Could not load middleware layer com.sap.mw.jco.rfc.MiddlewareRFC'. Then i found the program is looking for sapjcorfc.dll file and this file was under the path C:\Program Files\SAP\JDT\eclipse\plugins\com.sap.mw.jco\lib.

Then i added the required JAR files from the path C:\Program Files\SAP\JDT\eclipse\plugins\ instead of refering from C:\lib. After this the program is working correctly eventhough i just added the jar file sapjco.jar under the folder C:\Program Files\SAP\JDT\eclipse\plugins\com.sap.mw.jco\lib without adding the sapjcorfc.dll.

Then i created a jar file for my project by using the packaging method "Link via manifest and copy files to" lib\. In this step the dll file is not linked.

I put this jar file in path e:\ and created a folder e:\lib and put all my jar files and dll file there. When i executed this jar from a *.bat file using the command

set path=E:\novell\consoleone\1.2\jre\bin

java -jar SchedulerManagerSwing

pause

I got the error "Could not load middleware layer com.sap.mw.jco.rfc.MiddlewareRFC'." which i got when i developed this project.

I think the error is due to sapjcorfc.dll. Please let me know how to link this DLL with jar file and let me know how to solve this problem.

Thanks & Regards,

H.K.Hayath Basha.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hai All,

Thanks a lot. Not the problem is solved.

I added sapjcorfc.dll is my class path as follows,

Manifest-Version: 1.0

Class-Path: classes12.jar lib/jsse.jar lib/ldap.jar lib/aii_proxy_gen.

jar lib/aii_proxy_rt.jar lib/aii_util_misc.jar lib/SAPmdi.jar lib/sap

jco.jar lib/sapjcorfc.dll

Created-By: IntelliJ IDEA

Main-Class: pm2s.ep.resetpassword.EPResetPwdSchedulerManagerSwing

My .bat file code is,

set path=E:\novell\consoleone\1.2\jre\bin

java -jar EPResetPwdSchedulerManagerSwing

pause

No need to use -Djava command in .bat file

I added librfc32.dll in C:\WINNT\System32 path only

Regards,

Basha/

Former Member
0 Kudos

Hai All,

Thanks a lot. Not the problem is solved.

I added sapjcorfc.dll is my class path as follows,

Manifest-Version: 1.0

Class-Path: classes12.jar lib/jsse.jar lib/ldap.jar lib/aii_proxy_gen.

jar lib/aii_proxy_rt.jar lib/aii_util_misc.jar lib/SAPmdi.jar lib/sap

jco.jar lib/sapjcorfc.dll

Created-By: IntelliJ IDEA

Main-Class: pm2s.ep.resetpassword.EPResetPwdSchedulerManagerSwing

My .bat file code is,

set path=E:\novell\consoleone\1.2\jre\bin

java -jar EPResetPwdSchedulerManagerSwing

pause

No need to use -Djava command in .bat file

I added librfc32.dll in C:\WINNT\System32 path only

Regards,

Basha/

Former Member
0 Kudos

also put the sapjco.jar in the java extension classes folder. jdk\jre\lib\ext\

Former Member
0 Kudos

put the sapjcorfc.dll in the system32 folder of windows. If it still does not work also put the librfc.dll in that came with the JCo zip file in the system32 folder. be careful and don't overwrite the existing librfc.dll in the folder. just rename it so you still have a copy. sometimes sapgui doesn't work with the librfc.dll file that comes shipped with JCo.

Former Member
0 Kudos

Hai,

I have tried the below combinations still i am getting the same error with a additional message "The procedure entry point RfcDsrInit could not be located in the dynamic link library LIBRFC32.dll"

set path=E:\novell\consoleone\1.2\jre\bin

java -jar SchedulerManagerSwing.jar

-Djava.library.path=E:\LDAP_Admin\exe\lib\sapjcorfc.dll

pause

or

set path=E:\novell\consoleone\1.2\jre\bin

java -jar SchedulerManagerSwing.jar

-Djava.library.path=E:\LDAP_Admin\exe\lib\

pause

Regards,

H.K.Hayath Basha.

Former Member
0 Kudos

Hello,

Say your Java program is in C:\temp.

1. Put your librfc32.dll in System32 folder & C:\temp.

2. Put your sapjcorfc.dll in C:\temp.

3. Then either you uncompress sapjco.jar(jar -xvf sapjco.jar) to C:\temp. or "set classpath=C:\temp\sapjco.jar;".

Then try tunning your program.

Regards,

Nagarjuna.

Former Member
0 Kudos

correct variant is

-Djava.library.path=E:\LDAP_Admin\exe\lib

and you also need to put into E:\LDAP_Admin\exe\lib\ file LIBRFC32.dll

Former Member
0 Kudos

you should add next parameter for jvm:

-Djava.library.path=<path to sapjcorfc.dll>