2013-06-13 65 views
0

我們有兩個單獨的相同Web應用程序實例。一個是沙箱,另一個是現場環境。兩者都訪問顛覆,因此我們設置svnClientAdapter來使用JavaHL。在應用程序的啓動,我們呼籲JhlClientAdapterFactory.setup();兩個單獨的JBoss Web應用程序上的JavaHL LinkageError:已由另一個類加載器加載

當第二個實例啓動時,我得到錯誤信息:

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 

這是很明顯的問題是什麼,但我不知道如何解決它。

System.loadLibrary(WINDOWSLIBS[i]); 

回答

0

我解決了它通過與應用程序本身部署所需的DLL。 svnClientAdapter也使用特殊屬性subversion.native.library來查找dll。所以在初始化方法我得到了應用程序與下面的方法運行中的絕對路徑:

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

後來我加入了圖書館的文件名,並設置屬性:

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

這似乎工作得很好。

0

你可以建立第三個「Web應用程序」,他們的工作將加載由任何其他實例部署在服務器上使用本機庫:

本機庫由svnClientAdapter使用方法加載

+0

我想這會工作,但我們無法控制哪個服務器上運行哪個實例,這意味着我無法確定每個實例是否正在運行「本機庫」 - 實例。但我用不同的方式解決了它。謝謝 –

相關問題