0

我们有同一个 Web 应用程序的两个独立实例。一个是沙盒,一个是实时环境。两者都在访问 subversion,因此我们设置svnClientAdapter为使用 JavaHL。在我们正在调用的应用程序启动时JhlClientAdapterFactory.setup();

当第二个实例启动时,我收到错误消息:

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

很明显问题是什么,但我不知道如何解决它。

使用以下方法加载本机库svnClientAdapter

System.loadLibrary(WINDOWSLIBS[i]);
4

2 回答 2

0

您可以构建第三个“Web 应用程序”,其工作是加载服务器上部署的任何其他实例使用的本机库

于 2013-06-13T08:08:27.487 回答
0

我通过使用应用程序本身部署所需的 dll 来解决它。svnClientAdapter 也使用特殊属性subversion.native.library来查找 dll。因此,在初始化方法中,我使用以下方法获取应用程序运行的绝对路径:

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

之后我添加库的文件名并设置属性:

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

这似乎工作得很好。

于 2013-06-13T11:49:21.900 回答