简体   繁体   English

在JBoss(热)重新部署之后找到所需的dll?

[英]Finding a needed dll after a JBoss (hot) redeploy?

My web application uses a native dll for part of its functionality (the location of which is provided in PATH). 我的Web应用程序使用本机dll来实现其部分功能(其位置在PATH中提供)。 Everything works until I make a change to the WAR and JBoss hot deploys this WAR. 一切正常,直到我对WAR进行更改,并且JBoss热部署此WAR。 At this point, the dll is no longer found and I need to manually restart the server. 此时,不再找到该dll,我需要手动重新启动服务器。

What is the best way to load the dll back into the app after a hot deploy? 热部署后将dll加载回应用程序的最佳方法是什么?

It might not be so easy. 可能不是那么容易。 Normally a DLL is tied to a specific classloader. 通常,DLL被绑定到特定的类加载器。 When you redeploy, that means that the original classloader used for your application is destroyed. 重新部署时,这意味着用于您的应用程序的原始类加载器已被破坏。 Unfortunately the Java Virtual Machine does not allow a second classloader to reload a DLL again. 不幸的是,Java虚拟机不允许第二个类加载器再次重新加载DLL。

You must have something static, that will never be unloaded by the Virtual Machine. 您必须具有静态的东西,该东西永远不会被虚拟机卸载。 Maybe having a second application that loads the DLL would be a solution, as redeploying the first application wouldn't then affect the DLL. 也许让第二个应用程序加载DLL是一个解决方案,因为重新部署第一个应用程序不会影响DLL。 I guess it could also be possible to create a Jar file that loads the DLL and add it to the classpath of JBoss itself, instead of adding it to your application. 我想也可以创建一个加载DLL的Jar文件,并将其添加到JBoss本身的类路径中,而不是将其添加到您的应用程序中。 Normally such servers have a "shared" directory where such jar files can be added that will be shared by all applications. 通常,此类服务器具有一个“共享”目录,可以在其中添加将由所有应用程序共享的jar文件。

The following bug from SUN sheds some light in this issue, which is way more general than just loading servlets: SUN的以下错误阐明了此问题,该问题比仅加载servlet更普遍:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4225434 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4225434

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM