cancel
Showing results for 
Search instead for 
Did you mean: 

Java Connector. "sapjcorfc.dll already loaded in another classloader"

jordi_escodaruiz
Active Participant
0 Kudos

Dear all:

I'm fighting against a Java Connector problem.

I'm using:

-JCO version 2.16

-Apache Tomcat 5.5.17

I have written the environment variables:

CLASSPATH pointing where I have sapjco.jar, sapjcorfc.dll

Path where i have sapjco.jar, sapjcorfc.dll.

I try to make a webservice which calls a RFC function in SAP.

Java program compiles and Deploy OK.

I load the web service in Tomcat.

When I call the java server page, I get this error message from Tomcat:

org.apache.jasper.JasperException: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc Native Library C:\Traspas\Projecte\lib\sapjcorfc.dll already loaded in another classloader. java.library.path C:\Tomcat5.5.17\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Java\jdk1.5.0_07\bin;C:\Traspas\Projecte\lib

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Seems that is trying to load twice sapjcorfc.dll?

I would be grateful if someone can give me help.

Thanks in advance.

Jordi

Accepted Solutions (0)

Answers (1)

Answers (1)

jordi_escodaruiz
Active Participant
0 Kudos

I close this thread.

I solved the problem by removing the SAP Java Connector library from my project, and adding it to the libraries loaded by Tomcat (common libraries),

jordi_escodaruiz
Active Participant
0 Kudos

I received a message asking for further clarification. I try to further explain.

Be sure sapjco.jar is not included in the application. Doing so will lead the system to load more than one time the SAP Java Connector. Sapjco.jar has to be loaded only once in the server.

To do so (in Windows & Tomcat environment):

1-Be sure sapjco.jar is not included in the WEB-INF folder.

2-Put sapjcorfc.dll and librfc32.dll in c:Windowssystem32

3-Put sapjco.jar in c:Tomcatcommonlib

4-Add a reference to sapjco.jar in the project (In Eclipse: Project/Properties/Java Build Path, Tab Libraries, Add External JARs.

5-Compile and deploy the application. Generate War file. If ant gives problems, add proper command to find sapjco.jar (section <path id=u201Dpath.baseu201D>, <include name=u201Dsapjco.jaru201D>)

6-Load the WAR file in Tomcat.

7-Stop and Start Tomcat.

8-Run the application.

A related thread: [|]

Hope this helps.