cancel
Showing results for 
Search instead for 
Did you mean: 

Exception:Native Library C:\WINDOWS\system32\sapjcorfc.dll already loaded

Former Member
0 Kudos

Hi All,

I am calling a bapi in my J2EE project developement environment being eclipse and jboss server 4.0.5.

When i first deploy the application it works fine however if i redeploy the application without shutting down the server it gives an exception:

-


17:24:26,796 ERROR [STDERR] java.lang.ExceptionInInitializerError: JCO.classInit

ialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

Native Library C:\WINDOWS\system32\sapjcorfc.dll already loaded in another class

loader

17:24:26,796 ERROR [STDERR] at com.sap.mw.jco.JCO.<clinit>(Unknown Source)

-


I have gone through these two threads :

-->

-->

and got the problem that i should not have sapjco.jar in lib folder(in my application .ear).........

they give the solution of adding jco references in a j2ee project :

and use this file application-j2ee-engine.xml

Can any one please suggest that how can i have any external reference while using JBoss server 4.0.5.

Accepted Solutions (0)

Answers (2)

Answers (2)

dirk_niemeier
Explorer
0 Kudos

Hi Vivek,

(I would like to send you a private message, but this forum doesn't support)

I am interesting of your solution to connect to SAP from jBoss. Do you use JRA or only JCO in jBoss? If only JCO do you every time establish a new connection to SAP when update some data? how is the performance?

regards

Dirk

Vlado
Advisor
Advisor
0 Kudos

You'd better ask this question in some JBoss forum. The ExceptionInInitializerError is not specific to JCO, you would get it with any dll. Nor has the question to do with Java EE 5 where you originally posted it.

Good luck!

Former Member
0 Kudos

Hi,

Thanks for your response.

Yesterday night i was able to solve the problem.

For other users i would like to mention the solution here.

1.) don't put the sapjco.jar in your application .ear

2.) For build path it should be put down some where else.

3.) Last put down the sapjco.jar in the lib folder of JBoss Server.As it will load the native library once when the server is started first.

Former Member
0 Kudos

Hi Vivek,

Does this also applies to WebLogic Server. I tried doing so at WebLogic Server, and the sapjco.jar is never loaded by the JVM. So, whenever the client calls a class from the "sapjco.jar", it always produces results like,

java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO;

Do you have any idea to solve this problem? I followed your instructions but it seems not working yet.

Hoping for your help.

Thanks and Best Regards,

John

Former Member
0 Kudos

Hi John,

Well as far as WebLogic is concerened I haven't tried that as we are using the JBoss server.

However I think that it should also follow the same approach.

May be you haven't put the sapjco.jar in the correct lib folder of server(where you have installed the server).

->In JBoss we have two lib folders

1)C:\Program Files\jboss-4.0.5.GA\server\default\lib

2)C:\Program Files\jboss-4.0.5.GA\lib

so i have put down the .jar file at first location.This is the location of common jar files(like log4j.jar, javax.servlet.jar etc.) used by the server that gets loaded itself by server.

and one important thing is that remove the sapjco.jar from

WEB-INF/lib folder of your application(Don't pack it with the .ear file).

Second Approach can be ->

I have struggled with this problem

When we use different versions of sapjco.jar and librfc32.dll,sapjcorfc.dll files it also throw exception.

.jar files and .dll files should be of same version(as released by SAP ).This may be the cause of your problem.

Try to work out with these approaches.I hope it may be able to solve out your problem

Thanks and Regards,

Vivek Mathur

Former Member
0 Kudos

Hi Vivek,

Thanks you very much for the effort and the response. I am now on my way to implement it.

Btw, have you tried running this one to Linux. It could be in your part, like Linux + JCO + JBoss. In my part, Linux + JCO + WebLogic.

I forgot to mention that I've run it correctly in Windows. Sorry for that. The problem that I am encountering now is on Linux deployment. But I believe your suggestion is a great start indeed in Linux deployment.

Right now, in Linux 64 bit, we have two library files (counterpart of the dll files in windows), librfccm.so, libsapjcorfc.so and the sapjco.jar. The library files are put into the jvm directories of the WebLogic and the sapjco.jar is put into \bea\wlserver_10.0\samples\domains\wl_server\lib. The library files have made the files permissions/mode status correctly, by using chmod. Also, the file versions are correct, sapjco-linuxppc64-2.1.8_64bit.

Upon done restarting the Weblogic server in Linux, and running the client program in Windows,

The first error that I encountered,

Message Exception: javax.ejb.EJBException: EJB Exception: ; nested exception is:

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].

Then, I run again the client program in Windows for the second time, then it give me this error,

Message Exception: javax.ejb.EJBException: EJB Exception: ; nested exception is:

java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO; nested exception is:

Do you have any idea on this one? Or perhaps, if you do have a friend who could shed a light on this one, that would be a great help. Sorry, if I sound demanding, but it's been two weeks that I am struggling to this problem and no solutions given yet.

Thank you for your help again and looking forward for your answer.

Thanks and Best Regards,

John Paz

Former Member
0 Kudos

Hi Vivek,

Thanks so much for the solution.

We got another version of the JCO libraries running in Linux for AMD/Intel 64Bit Machines. Then, it worked!

More power!

Best Regards,

John

Former Member
0 Kudos

Hi John,

Sorry for late reply(as i was out of station). So you have already solved the problem.

These are the problem that we normaly face(like having

different versions), and so they need to work around.

I haven't used Linux with the application yet, may be in future we will use that.

However it's good to know that at last your problem was solved.

Thanks

Vivek Mathur