cancel
Showing results for 
Search instead for 
Did you mean: 

ClassLoader exception for native library

Former Member
0 Kudos

Hi, I'm having the following error when using libraries which use JNI in Web Dynpro

java.lang.UnsatisfiedLinkError: Native Library C:\usr\sap\J2E\JC00\j2ee\os_libs\jniwrap.dll already loaded in another classloader

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1551)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1482)

at java.lang.Runtime.load0(Runtime.java:737)

at java.lang.System.load(System.java:811)

at com.jniwrapper.DefaultLibraryLoader.loadLibrary(SourceFile:209)

at com.jniwrapper.Library.loadNativeCode(SourceFile:44)

at com.jniwrapper.Library.loadNativeCode(SourceFile:69)

at com.jniwrapper.Library.ensureNativeCode(SourceFile:79)

at com.jniwrapper.PlatformContext.a(SourceFile:252)

at com.jniwrapper.PlatformContext.getDefaultStructureAlignment(SourceFile:189)

at com.jniwrapper.Structure.init(SourceFile:112)

at com.jniwrapper.win32.system.VersionInfo.<init>(SourceFile:48)

at com.jniwrapper.win32.system.Kernel32.isUnicode(SourceFile:66)

at com.jniwrapper.win32.FunctionName.<clinit>(SourceFile:24)

at com.jniwrapper.win32.system.Kernel32.<clinit>(SourceFile:28)

at com.jniwrapper.win32.WinFunctionCache.setupEncoding(SourceFile:39)

at com.jniwrapper.win32.WinFunctionCache.<init>(SourceFile:28)

at com.jniwrapper.win32.ole.OleFunctions.<init>(SourceFile:81)

at com.jniwrapper.win32.ole.OleFunctions.getInstance(SourceFile:89)

at com.jniwrapper.win32.ole.OleFunctions.oleUninitialize(SourceFile:1046)

at com.orbitel.comp.Conexion.wdDoInit(Conexion.java:120)

at com.orbitel.comp.wdp.InternalConexion.wdDoInit(InternalConexion.java:105)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:346)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:349)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:599)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

I think the problem is because that I have to put the library into J2EE Server and not in the lib aplication. Where do I have to store this JAR file in the webserver? I haver seen this thread which talk some thing like this.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I was interested in the case and i was testing and I saw it is that you can :

1) make a project that is shared, where you can put all your libraries classes and your factory class that, is like your bussiness tier.

2 )In your webdynpro application makes a reference to this proyect in Properties > Projects and check the other Reference project with the libraries.

3 )Changes to the navigator view and go to gen_wdp> application.xml and load it.

Go to Application and ADD new SharingReference to the project that contains your bussines tier(step 1).

this maintains the librarie class loader always above and you wouldn't have to restart the server always that you makes a deploy of your presentation tier.

and and it´s all, it´s work.

Josue Cruz

Message was edited by: Josue Cruz

former_member182372
Active Contributor
0 Kudos

Hello Pablo,

What kind of references do you have in your WD (sharing references and used DC`s)? And what code did cause this error?

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

I have no sharing references in the project, because I'm using JNIWrapper(no SAP library) and I thought the libraries wouldn't be in the server so no sharing reference would be found (is this okay), I 've store the .jar files into the the lib folder.

This is the code which cause the error.

OleFunctions.oleInitialize();

Former Member
0 Kudos

Pablo,

This is the source of problem -- you are loading your class more then one time, and hence loadLibrary call is executed twice. It is impossible to load one DLL to the same process (jvm) more then one time.

So instead create external library for your OLE stuff.

VS

Former Member
0 Kudos

Ok, I got it, but how do I do this? Do you have any path, or documentation?

Regards.

Former Member
0 Kudos

See /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

VS

Former Member
0 Kudos

Hi Valery, i´m agree with you, the JVM only can open a library once, but i think that there are any way to close it, or free the resources of it.... Do you know some way to do it ?...

Thnks..

Joshua