cancel
Showing results for 
Search instead for 
Did you mean: 

EJB, geronimo and "sapjcorfc.dll already loaded in another classloader"

Former Member
0 Kudos

Hi.

I've written a standalone application which uses JCo to connect with our SAP-system. So far, so good. No as I'm porting the app to EJBs I ran into the error

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc Native Library C:\WINNT\system32\sapjcorfc.dll already loaded in another classloader..

The first call to SAP after starting the server (geronimo 2.1) is working but if I redeploy the application and try to connect to SAP the error is thrown.

After restarting geronimo it's working again (until I re-deploy the app).

Is there any way to avoid this error without restarting the server everytime I re-deploy the app?

Do I have to put sapjco.jar in a different location than geronimo's repository (there is no WEB-INF because it's not a web application)?

hope you could help a little...

Stefan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Finally I got it working!

sapjco.jar is now located in

geronimo/lib

. There it will be automatically included by eclipse if you select the "Apache Geronimo" library as a dependency for your EJB-project.

In the EAR-project I configured "J2EE Module Dependencies" and added

geronimo/lib/sapjco.jar

as external jar.

Build, export as ear and deploy it to geronimo: tataa, working. No restart of geronimo required after deploying a new version of the app.

Thanks, Franz for your hints. They got me to the right solution.

Stefan

Edited by: Stefan Borchert on Jun 19, 2008 10:48 AM

Former Member
0 Kudos

Hello,

put the sapjco.jar into geronimos /lib directory (and remove it from your applictions library folder) -> the jar should than only be loaded once by the highest level classloader without causing the reload problem

regards franz

Former Member
0 Kudos

I'm sorry but this didn't work.

Additionally I tried to remove the dependency in openejb-jar.xml and removed the sapjco.jar from geronimo repository but this didn't work neither.

I've got the following structure:


geronimo
 [+] bin
 [+] lib
      - sapjco.jar

and sapjcorfc.dll in

C:\Winnt\system32

Additionally I had to copy sapjco.jar to some other directory and add this to the build path of the project. Otherwise I would get:

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

at

JCO.setMiddlewareProperty( ... );

(first use of JCo)

very annoying :-{

Former Member
0 Kudos

Hello,

have look into your application ear file (unpack with any zip program) and look if your build program inculdes sapjco.jar into the ear file

AFAIK when adding libs in eclipse for example, these libs are put into the application ear too

regards franz

Former Member
0 Kudos

I do not use EAR, but pack the (server-)app as a simple jar file (eclipse: Export->EJB-Jar). This jar includes a file caled openejb-jar.xml where dependencies to used libraries are definied:


      <dependency>
        <groupId>com</groupId>
        <artifactId>sapjco</artifactId>
        <version>1.0</version>
        <type>jar</type>
      </dependency>

These libraries are located under geronimo->repository (e.g.

repository\com\sapjco\1.0\sapjco-1.0.jar

).

I will try again without this dependency and only one sapjco.jar.

edit:

This didn't work. "NoClassDefFound" (as expected) :-{

Edited by: Stefan Borchert on Jun 17, 2008 9:28 AM