cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrent use of SAP JCO

Former Member
0 Kudos

Hello everybody.

I'm developing a Java web application where I have to access the SAP system inside a company. I'm using JCO and it works fine, but whenever I deploy the web application in Tomcat, I must restart it to work with it again. If not I get the following exception:

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [Native Library /usr/lib/libsapjcorfc.so already loaded in another classloader]

I found some threads about this problem in the forums, and the solution was to put the SapJco.jar into tomcat commons/lib directory, not inside the WEB-INF/lib. I did that and it's still not working.

Does anyone know what to do?

Thank's in advance.

Regards.

Daniel.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There is no step by step on that link. Do you have another source?

Regards.

Former Member
0 Kudos

IIRC, you could place SAP Jco jars and shared libraries into $/commom/lib

Former Member
0 Kudos

Hi Daniel,

I guess you have included SAPJCO.jar file and required sapjco.dll file in your application's JAR file and deployed on the server.

So, what happen is, Every time you deployed your application, this dll file also loaded in classloader.But as this dll file is already loaded by the privious deployment, you will get this error. So, dont include this dll or jar file in your application JAR/EAR file. But give only reference to this library in your application XML file.So, at runtime it will use this library from the server, which is already loaded.

Regards,

Bhavik

Former Member
0 Kudos

Well, I think that was what I did at the begining, but know I'm not including the sapjco.jar file in my application. Instead I'm including it in the shared directory of my servlet server, Tomcat. I'm not referencing the shared library inside the web.xml file, perhaps that is the problem. It works because Tomcat includes all the libraries in the commons/lib in the classloader, but I'm still getting the problem.

Can you explain me how to reference the library from the web.xml file?

Thanks.

Former Member
0 Kudos

Hi Daniel,

You have to add following XML elements in your XML file.

<application-j2ee-engine>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="library">com.sap.mw.jco</reference-target>

</reference>

<provider-name>sap.com</provider-name>

<fail-over-enable

mode="disable"/>

</application-j2ee-engine>

We are using this in WAS server. I guess for tomcat also its similar to this only.

Regards,

Bhavik

Former Member
0 Kudos

I put that in my web.xml, and the problem is still there i don't know why. It isn't a very big problem because the application works correctly. I will have to pay attention when deploying to stop the server first, in case I can't solve it.

Thank you for you help.

Former Member
0 Kudos

Hi Daniel,

Where you r developing your Web Application?

If you are developing in NDS then you have one xml file named application-j2ee-engine in which you can specify this reference. And it will work correctly.

Regards,

Bhavik

Former Member
0 Kudos

> Instead I'm including it in the shared

> directory of my servlet server, Tomcat.

From my reply in the:

DLL-classloader restrictions imply that you should put mentioned jars into server's classpath. On Tomcat, you can do this placing them into $/commom/lib

PS. Into common, not shared

--

Sam Mesh