开发者

JBoss automatic redeploying

开发者 https://www.devze.com 2023-01-17 21:57 出处:网络
As I understand it, JBoss* monitors a variety of file types in /deploy and performs certain actions when the file开发者_如何学Python changes. For example, JBosswill redeploy an EAR when its last-modif

As I understand it, JBoss* monitors a variety of file types in /deploy and performs certain actions when the file开发者_如何学Python changes. For example, JBoss will redeploy an EAR when its last-modified time changes.

Therefore, I could use some really nasty code to make an EAR redeploy itself, like this:

URL url = this.getClass().getClassLoader().getResource("../RavenWeb.ear");
String path = url.getPath();

File ear = new File(path);
ear.setLastModified(System.currentTimeMillis());

But what I really want to do is just have JBoss redeploy the webapp when an external config file changes. Say the config file lives at C:/foo/bar.properties.

Is there an MBean or some other way getting this done that won't get me mauled by velociraptors?


*I'm using JBoss 5.1.0, if it matters.


I think your best shot is having a MBean that will reload your config file whenever you call a function on it. If you wan't this to happen automatically, you can also consider having a MBean handling the configuration file for you. This way, you can just update MBean properties instead of changing a configuration file.


I've copied the Log4JService implementation and put it in a .sar.

It just simply polls the configuration file, parse it and put a Configuration object in the JNDI, so that I can retrieve it in my application. In this way you don't have to redeploy the entire application, and you can use the new configuration in the app.

If you have to do something else than simply reloading the app, you can do it in this service.

0

精彩评论

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

关注公众号