Search code examples
javajbossjboss7.xhotswap

JBoss with HotSwap agent


Has anyone used JBoss AS 7.1 with DCEVM and HotSwap agent in production? Any tutorial anywhere? Is it possible to add new packages/classes through HotSwap agent, or just to replace existing ones?

I'm sorry the question is so vague. I'm merely researching proposed technologies.

Another point: do I have to deploy as exploded .war always, and replace/add .class files inside it? Or can I deploy as zipped .war and copy additional zipped .jars alongside it?

My architecture is that I have a servlet and then additional components need to be accessible from it. These components I want to add/replace at runtime.


Solution

  • In this moment not is possible, there is an open issue Jboss support #27:

    JBoss 7 use OSGI classloading and hence agent core classes are not available from application classloader (this is not the case with standard classloaders with parent delegation).

    The solution would be to add -Djboss.modules.system.pkgs=org.hotswap.agent to older agent versions (similar to https://issues.jboss.org/browse/WFLY-895).

    However Hotswap agent now sets all necessary properties for JBoss on startup.

    And this:

    Currently, JBoss 7 starts correctly, but ignores configuration properties (extraClasspath, watchResources, webappDir). Hotswap via debugging is still available, but you are unable to use alternative source base.

    OSGI classloading must be "hacked" to allow all properties. See Jetty/Tomcat plugin for similar implementation.