cancel
Showing results for 
Search instead for 
Did you mean: 

Error in JCO Connection prorgam

Former Member
0 Kudos

Hi Experts,

I am developing one tomcat application using servlet. In servlet i am connecting to R/3. For this i am writing JCO Connection code. This Java file is compiled, but while running the servlet in browser it is giving exception like


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 [no sapjcorfc in java.library.path]. java.library.path [C:Tomcat 5.0bin;.;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:jdk1.5.0_12bin;C:Program Files (x86)AdobeFlex Builder 2Flex SDK 2bin;C:j2mej2me_cldcbinwin32;C:j2memidp1.0.3fcsbin;C:jdk1.5.0_12libsapjco.jar]
	com.sap.mw.jco.JCO.<clinit>(JCO.java:738)
	ConnectToR3.getConnection(ConnectToR3.java:25)
	HitServlet.doGet(HitServlet.java:29)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

How to slove this problem. Is their any other way to connect to SAP R/3 from Servlets. I created normal java program without servlets, it's wokring fine. But If paste the same code in servlets mean it is giving above Exception.

Please Help me........ Give any solution to this problem.

Regards,

Sunil

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186016
Active Contributor
0 Kudos

sapjcorfc.dll is required on the server to handle jco connections.

It seems it is not there or if it is there but is not part of "path" environment variable on the server.

1) Go to you server. Search for this file and add the directory containing this file to path environment variable for server. You have to restart your server.

2) It runs in your local java program because your local java program runs in local JVM instance. And on your local machine you have the sapjcorfc.dll plus its folder being in part of path environment variable.

3) The servlet runs in ServletContext on the server JVM instance where the sapjcorfc.dll cann't located.

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

Hi Sharma,

Thanks for fast replay.

I places the dll file in server. It's working fine.

Regards,

Sunil