0

We have two separate instances of the same web application. One is a sandbox and one a live environment. Both are accessing subversion so we set up svnClientAdapter to use JavaHL. On the startup of the application we are calling JhlClientAdapterFactory.setup();

When the second instance starts I get the error message:

Failed to load JavaHL Library.
These are the errors that were encountered:
Native Library C:\jboss-6.1.0.Final\bin\native\msvcr100.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\msvcp100.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libapr-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libapriconv-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libeay32.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\ssleay32.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libaprutil-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\dbghelp.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsasl.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_subr-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_delta-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_diff-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_wc-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_fs-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_repos-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_ra-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvn_client-1.dll already loaded in another classloader
Native Library C:\jboss-6.1.0.Final\bin\native\libsvnjavahl-1.dll already loaded in another classloader
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = C:/jboss-6.1.0.Final/bin/native

It's pretty obvious what the problem is, but I have no idea how to resolve it.

The native libraries are loaded by the svnClientAdapter using the method:

System.loadLibrary(WINDOWSLIBS[i]);
arserbin3
  • 6,010
  • 8
  • 36
  • 52
Michael Schmidt
  • 391
  • 2
  • 14

2 Answers2

0

You could build a third "web application" whose job would be to load native libraries used by whatever other instance is deployed on the server

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
  • I guess this would work, but we have no control over which instance is running on which server, which means I can't be sure, that every instance is running with the "native lib"-instance. But I solved it in a different way. Thanks – Michael Schmidt Jun 13 '13 at 11:44
0

I solved it by deploying the needed dll with the application itself. svnClientAdapter is also using a special property subversion.native.library to find the dlls. So in the initialization method I'm getting the absolute path the application is running in with the following method:

String strPath = getClass().getClassLoader().getResource("someResourceThatExists").getPath();
strPath = strPath.replace("filenameOfResource");

Afterwards I'm adding the filename of the library and setting the property:

System.setProperty("subversion.native.library", strPath);

That seems to work quite well.

Michael Schmidt
  • 391
  • 2
  • 14