cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with sapjco3 and weblogic

Former Member
0 Kudos

Hi everybody.

I have a Java - ADF (JDeveloper) project with Weblogic, the SAP JCo 3.0.1 and the HiberSAP modules for mapping. The project deploys and works very well. The problem comes with re-deploying the whole project. I get this (maybe well-known) error when trying to re-access the SAP funcions via Java methods:

java.lang.UnsatisfiedLinkError: Native Library C:\WINDOWS\system32\sapjco3.dll already loaded in another classloader

I have my project in both Windows (XP) and Linux (Red Hat/Ubuntu). So in Linux it's the same, with the libsapjco3.so.

I deployed the sapjco3.jar and the HiberSAP related jars to Weblogic as shared libraries so my project could be deployed without re-deploying the SAP jars and avoid this situation. But I still got the same error.

There is very little information about this error on the net, some people says that installing some Microsoft patches (such as the .NET Framework 2.X or the Microsoft Visual C++ 2005 Redistributable or similars) the problem should be solved. I tried this without success, and if even works, what should I do for Linux????

Another people says, with another dlls that throw the same error, using static methods and variables, but I can't do it 'cause I need several non-static methods for my project.

So, is there any possible solution to this??? and/or how could I solve it?????

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I had this problem too and found that SAPJCo3 uses JNI to integrate with SAP system using DLLs. These dlls are loaded when sapjco3.jar is loaded.

When sapjco3.jar is packed with war file and deployed for first time on Java app server this dll is loaded and application runs correctly. But when application is undeployed this loaded dll is still left in memory. Thus causes second deployment to fail as sapjco3.jar tries to reload the dll again.

Workaround for above problem is to have sapjco3.jar not packed with war file but should be deployed as a library or kept in common lib folder. This workaround would work well when HiberSAP is not used. If HiberSAP is used then it would cause issue described in SDN Forum Link: [Error DataDestinationProvider already registered|;

Finally found that using SAP JCA Adapter would solve these kind of issues as Adapter is deployed only once and would not cause dll load issue. SAP WAS has its own JCA adapter which can be used and for non SAP App server there is open source version available.

Hope this help other people who are planing to use SAPJCo3 on Java App server.