开发者

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). Everything works until I make a change to the WAR and JBoss hot deploys this WAR. At this point, the dll is no longer 开发者_Python百科found and I need to manually restart the server.

What is the best way to load the dll back into the app after a hot deploy?


It might not be so easy. Normally a DLL is tied to a specific classloader. 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.

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. 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. Normally such servers have a "shared" directory where such jar files can be added that will be shared by all applications.

The following bug from SUN sheds some light in this issue, which is way more general than just loading servlets:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜