Standard Java Hotswap allows only method body change , which makes it practically unusable. (Here you can find some explanations why and how) This article is all about reloading java code without restart :-)

DCEVM

DCEVM is a JRE patch witch allows almost any structural class change on Hotswap (with an exception of a hierarchy change). Although Hotswap agent works even with standard java, we recommend to use DCEVM (and all tutorials use DCEVM as target JVM). Free and open source. See https://dcevm.github.io/

Spring Loaded

Spring Loaded is a JVM agent for reloading class file changes whilst a JVM is running. It transforms classes at load time to make them amenable to later reloading. Unlike 'hot code replace' which only allows simple changes once a JVM is running (e.g. changes to method bodies), Spring Loaded allows you to add/modify/delete methods/fields/constructors. The annotations on types/methods/fields/constructors can also be modified and it is possible to add/remove/change values in Enum types. Spring Loaded is usable on any bytecode that may run on a JVM, and is actually the reloading system used in Grails 2. Free and open source. See https://github.com/spring-projects/spring-loaded

Hotswap agent – OSS

Hotswap agent is a plugin container with plugin manager, plugin registry, and several agent services (e.g. to watch for class/resource change). It helps with common tasks and class loading issues. It scans class path for class annotated with @Plugin annotation, injects agent services and registers reloading hooks. Runtime bytecode modification is provided by javaasist library. Free and open source.  See http://www.hotswapagent.org/

Plugins

Plugins administered by Hotswap agent are usually targeted towards a specific framework. For example Spring plugin uses agent services to:

  • Modify root Spring classes to get Spring contexts and registered scan path
  • Watch for any resource change on a scan path
  • Watch for a Hotswap of a class file within a scan path package
  • Reload bean definition after a change
  • ... and many other

Packaged plugins:

  • Hibernate (4x) - Reload Hibernate configuration after entity create/change.
  • Spring (3x) - Reload Spring configuration after class definition/change.
  • Jetty - add extra class path to the app class loader. All versions supporting WebAppContext.getExtraClasspath should be supported.
  • ZK (5x-7x) - ZK Framework (http://www.zkoss.org/). Change library properties default values to disable caches, maintains Label cache and bean resolver cache.
  • Logback - Logback configuration reload
  • Hotswapper - Watch for any class file change and reload (Hotswap ) it on the fly via Java Platform Debugger Architecture (JPDA)
  • AnonymousClassPatch - Swap anonymous inner class names to avoid not compatible changes.
  • ELResolver 2.2 (JuelEL, Apache Commons EL, Oracle EL 3.0)- clear ELResolver cache on class change. Support Hotswap for #{...} expressions.
  • Seam (2.2, 2.3) - flush JBoss reference cache. Support for properties file change (messages[])
  • JSF (mojarra 2.1, 2.2) - support for application resource bundle files change (properties files).
  • Osgi Equinox - Hotswap support for Eclipse plugin or Eclipse platform development.
  • CDI/Weld - reload bean class definition after class change.
  • WebObjects - Clear key value coding, component, action and validation caches after class change.

Jrebel

JRebel is a JVM Java Agent that integrates with application servers, making classes reloadable with existing class loaders. Only changed classes are recompiled and instantly reloaded in the running application. JRebel plugs into IDEs and build systems. Classes and static resources are loaded straight from the workspace. JRebel integrates with over 100 frameworks. Dedicated JRebel plugins will rebuild caches, rewire components and apply configuration to the runtime as necessary. Free for open source / personnal use at  https://my.jrebel.com or commercial license. See https://zeroturnaround.com/software/jrebel/

JRebel Packaged plugins:

  • ADF Core plugin, Allows ADF page definition files to be reloaded
  • ADF Faces plugin, Patches ADF implementation of JSF lifecycle allowing Mojarra plugin to do the rest
  • AspectJ Plugin, Enables the load-time-weaving of AspectJ aspects. Can alter class loading/initialization order during startup
  • ATG plugin, The plugin reinitializes ATG Nucleuses when the Nucleus elements Java class file has changed., It also re-reads the values from the properties file in the reloading process. So that when Nucleuses have new connections then they will be initialized and if they have new properties values then those will also be there
  • Axis2 plugin, adds, removes, reloads web services defined in the services.xml file, adds, removes, reloads web services defined using JAXWS annotation
  • Axis2 WAS plugin, adds, removes, reloads web services defined using JAXWS annotation
  • Axon Plugin, Fixes issue with Axon registering duplicate listeners to EventBus on Spring Bean reconfiguratio
  • BVal plugin, description=Reload changes to MetaBean definitions when the underlying validated class or its composing validation annotations change.,
  • Camel plugin, Updates a CamelContext when one or more of its associated RouteBuilder classes are changed
  • CaptainCasa plugin, Disables Captain Casa layout buffer, so that JSP reloading works out of the box
  • Click plugin, Reloads the menu definition from menu.xml
  • CXF Plugin, Tracks changes in the configuration of Apache CXF REST/WS applications
  • Deltaspike plugin, Prevents exceptions during class reloading
  • Ebean plugin, Integration with Ebean load time enhancemen
  • Eclipse RCP Plugin, Refreshes plugins when plugin.xml changes
  • EclipseLink MOXy plugin, Support for the EclipseLink MOXy JAXB implementation
  • EclipseLink plugin, Reloads an EntityManagerFactory when any of the mapping files or annotated entity classes changes., When an entity class is reloaded the corresponding cache entries are flushed
  • Equinox OSGI Plugin, description=Equinox OSGI Integration.,
  • Facelets plugin, Turns on facelet development mode for automatic reloading of facelets., Provides reloading of facelet tag libraries
  • GlassFish EJB Plugin, Supports adding new EJBs on the fly and altering the existing EJB interfaces
  • Grails 2 & Grails 3 CLI Plugin, description=Make Grails 2 & Grails 3 CLI use JRebel instead of Spring Reloaded,
  • Grails 2 Plugin, description=Make Grails2 use JRebel instead of Spring Reloaded,
  • Grails 3 Plugin, description=Make Grails 3 use JRebel for reloading,
  • Groovy Plugin, Refreshes Groovy class metadata and call site cache on class change., After reload, call site cache may be misaligned for obsolete methods on stack
  • Guice plugin, Supports adding new components and injecting new implicit dependencies., Wires changed dependencies in Guice singletons
  • GWT plugin, Enables reloading of client-side classes in hosted (development) mode. Server-side classes should be reloaded without the plugin., , Limitations: Native Javascript methods may not be supported
  • Hibernate 5 plugin, Enables configuration reloading (rebuilding of Hibernate's SessionFactory) when updates are detected to underlying configuration resources (either XML mapping files or model classes with JPA annotations)., Enables automatic schema updating if hibernate.hbm2ddl.auto=update or schemaUpdate=true on org.springframework.orm.hibernate5.LocalSessionFactoryBean., , Limitations: The SessionFactory rebuilding works when it is being built through classes HibernatePersistence, HibernateService, org.jboss.hibernate.jmx.Hibernate or org.springframework.orm.hibernate3.LocalSessionFactoryBean. All classes that create SessionFactory instances have to be handled separately. If user creates SessionFactory in his own code, the integration won't capture that
  • Hibernate plugin, Enables configuration reloading (rebuilding of Hibernate's SessionFactory) when updates are detected to underlying configuration resources (either XML mapping files or model classes with JPA annotations)., Enables automatic schema updating if hibernate.hbm2ddl.auto=update or schemaUpdate=true on org.springframework.orm.hibernate3.LocalSessionFactoryBean., , Limitations: The SessionFactory rebuilding works when it is being built through classes HibernatePersistence, HibernateService, org.jboss.hibernate.jmx.Hibernate or org.springframework.orm.hibernate3.LocalSessionFactoryBean. All classes that create SessionFactory instances have to be handled separately. If user creates SessionFactory in his own code, the integration won't capture that
  • Hibernate Validator plugin, Enables adding/editing/removing Bean Validation constraint annotations on bean classes and parent constraint annotation types (i.e., supports composite constraints)., Enables creating/editing custom Bean Validation constraint annotation types., , Limitations: Does not alter database schema., , Limitations: Changes to META-INF/validation.xml are not propagated., , Limitations: Changes to XML constraint mappings are not propagated (initial mappings are retained)
  • HK2 plugin, HK2 integration
  • Hybris plugin, Hybris integration
  • iBatis plugin, Refreshes changes in iBatis SQL maps., , Limitations: Only supports refreshing sql maps and not anything else., , Limitations: Does not suppor mappingLocations in spring SqlMapClientFactoryBean
  • Infinispan Plugin, Infinispan integratio
  • Jackson 1.x plugin, Makes Jackson pick up changes (including changed annotations) to classes that it serializes to JSON or deserializes from JSON. Does this by clearing JSON (de)serializer caches for changed classes., , Limitations: Only serializer caches are updated. Doesn’t update de-serializer caches
  • Jackson 2.x plugin, Makes Jackson pick up changes (including changed annotations) to classes that it serializes to JSON or deserializes from JSON. Does this by clearing JSON (de)serializer caches for changed classes., , Limitations: Only serializer caches are updated. Doesn’t update de-serializer caches
  • Jasypt Plugin, Allows reloading Jasypt configurations. NB! Defeats password cleaning
  • JAXB Plugin, Enables support for reloadable classes in JAXBContext, Marshaller & Unmarshaller also pick up class changes immediatel
  • JBoss AOP plugin, Allows for load-time weaving of JBoss AOP aspects. (JRebel agent must be placed before JBoss AOP agent in JVM arguments.
  • JBoss EJB Plugin, Supports adding new EJBs on the fly, altering existing EJB interfaces and injecting new @EJB fields
  • JBoss7 Plugin, Supports adding new EJBs on the fly, altering existing EJB interfaces and injecting new @EJB fields., set -Drebel.jboss7_plugin.reload_ejb=false to disable adding and injecting new EJB bean
  • JDBC Plugin,
  • Jersey 2 plugin, description=Support for Jersey 2 configuration reloading,
  • Jersey plugin, description=Support reloading the configuration of Jersey 1.x applications.,
  • Jetty Servlet Context Plugin, description=Jetty Servler Integration.,
  • JRuby Plugin, description=null,
  • Liferay plugin, Reloading of JSP hooks, Reloading of portlet properties and xml configuration file
  • Liferay status plugin, description=null,
  • Lift plugin, Makes Lift pick up more changes in LiftScreens, Wizards, RestHelpers and MVCHelpers. Does this by re-instantiating any singletons that extend the above-mentioned classes., Keep in mind that the singletons you write that extend the mentioned Lift classes may be initialized multiple times when using this plug-in., , Limitations: Some changes in closures/anonymous functions will still cause problems that require restarts., See http://www.zeroturnaround.com/blog/lift-support-in-jrebel/ for additional information
  • Log4j plugin, Remembers the configuration file used for Log4j initialization, monitors it for updates, makes Log4j reinitialize itself when this file is changed., Includes a 3rd party contribution from Julien Richard
  • Log4j2 plugin, Log4j2 JRebel plugin. Remembers the configuration file used for Log4j2 initialization, monitors it for updates, makes Log4j2 reinitialize itself when this file is changed
  • Logback plugin, Remembers configuration files that Logback loaded it's configuration from (e.g. logback.xml). If updates to those files are detected, framework configuration is rebuilt
  • Magnolia Plugin, Magnolia CMS integratio
  • Metro (JAX-WS) plugin, Keeps track of sun-jaxws.xml and class changes, invoking deploymentDescriptorParser to rebuild the mappings, Updates Metro's dynamic servlets on servlet 3.0 environment
  • Metro Spring plugin, description=Watches jaxws-spring bindings and reloads endpoints,
  • Mojarra plugin, Reloads JSF configuration and reconfigures managed beans., Refreshes Mojarra annotation and XML-based configuration., Turns on Mojarra development mode and Facelet refreshing
  • Mustache Plugin, Reloads com.github.spullara.mustache templates to Mustache objects at run time
  • MyBatis plugin, Reloads modified SQL maps
  • MyFaces plugin, Reloads JSF configuration and reconfigures managed beans
  • OpenJPA plugin, Reloads an EntityManagerFactory when any of the mapping files or annotated entity classes changes., When an entity class is reloaded, the corresponding cache entries are flushed
  • OpenWebBeans plugin, Refreshes OpenWebBeans class metadata and wires changed dependencies on class change
  • Picketlink Plugin, Picketlink integratio
  • Prettyfaces plugin, Enables prettyfaces-config.xml reloading
  • Primefaces plugin, Cleans Primefaces <pe:importEnum> and <pe:importConstants> tags internal caches when underlying classes change
  • RESTEasy plugin, Configuring through context-param javax.ws.rs.Application., Configuring through listener (org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap)., Configuring through filter (org.jboss.resteasy.plugins.server.servlet.FilterDispatcher)., Configuring through servlet (org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher)., Only configuring an Application class is supported (a class that extends javax.ws.rs.core.Application – it is a standard JAX-RS way)., Reloading of JAX-RS annotated methods (adding/removing/changing)., , Limitations: No RestEasy specific/exotic ways of configuration is supporte
  • RESTlet plugin, Makes Application of RESTlet framework as a reloadable clas
  • Scalate plugin, Allows scalate templates to reference new fields and methods in classes
  • Seam 2 plugin, Supports loading new Seam 2 component definitions, either from annotated Java classes or from components.xml. Renaming or removing existing definitions is not supported., Refreshes seam component metadata and interceptors on class change. Supports reloading Seam method metadata annotations like @Observer, @RaiseEvent, etc., Supports reloading navigation files (pages.xml, *.page.xml) outside Seam's development mode (supported for Seam 2.1.x and 2.2.x)., , Notice: It is recommended to turn off Seam's development mode while using Seam together with JRebel
  • Seam 3 plugin, Minor Seam3 compatibility fixes
  • Seam-Wicket plugin, Lets Seam Wicket integration load-time-weave Wicket component
  • Solder plugin, Prevents exceptions during class reloading
  • Spring AOP Plugin, description=null,
  • Spring Bean Plugin, Monitors Spring bean definitions in xml-files, reloads them when changed., Monitors packages that could contain Spring beans defined by annotations. If new beans (or changes to old ones) are seen, reloads them., Makes Spring re-do the bean auto-wiring and singleton bean configuration., Disables caches for properties that are replaced for property placeholders in Spring's XML configuration files. When underlying properties files have changed, new values will be inserted on next reloading of these Spring beans
  • Spring Boot Plugin, Provides Spring Boot properties integratio
  • Spring Context Plugin, Monitors Spring bean definitions in xml-files, reloads them when changed., Monitors packages that could contain Spring beans defined by annotations. If new beans (or changes to old ones) are seen, reloads them., Makes Spring re-do the bean auto-wiring and singleton bean configuration., Disables caches for properties that are replaced replaced for property placeholders in Spring's XML configuration files. When underlying properties files have changed, new values will be inserted on next reloading of these Spring beans
  • Spring Core plugin, Spring Core OSGi bundle support
  • Spring Data Plugin, Reloads Spring Data repositories and persistent entities
  • Spring MVC plugin, Reload URL mappings (defined by @RequestPath annotations) when Spring beans have changed. (Before processing a request, Spring MVC plugin tells Spring core plugin to check/reload the beans. If any bean was reloaded, Spring core plugin sends notification to Spring MVC plugin, which then triggers URL mappings rebuilding., Also supports reloading other annotations: @ExceptionHandler, @ModelAttribute, @RequestParam., The plugin ID intentionally collides with the one of Spring core plugin. Spring MVC integration depends on Spring core integration and cannot be enabled independently
  • Spring ORM Plugin, description=null,
  • Spring OXM Plugin, description=null,
  • Spring Security plugin, Handles adding/editing of annotation-based security checks. Handles adding/modifying/removing of http blocks in xml configuration file
  • Spring Webflow plugin, Turns on flow definitions hot-loading even in production mode
  • Spring WS plugin, Reloads endpoint mappings when classes have changed (annotation-driven conf) or new endpoint is added in via xml (xml conf), Republishes wsdl after xsd is changed (when using dynamicWsdlDefinition
  • Stripes plugin, Adds support for adding/removing/reloading action beans on the fly., Supports stripes-guice and stripes-guicer plug-ins for instantiating Guice ActionBeans. (available since JRebel 4.0 M2), Includes 3rd party contributions from Andreas Knifh
  • Struts 1 plugin, Reloads full Struts configuration (by forcing Struts to re-create it's ActionServlet when updates to underlying configuration XML-files are detected. (XML configuration files are remembered when Struts is initializing itself.), Reloads Struts's message resources by emptying the message caches when there are any updates to message resources. (Message resource files are remembered when Struts is initializing itself.
  • Struts 2 plugin, Keeps track of XML configuration file updates and triggers the Struts2 configuration reloading when there are any., Keeps track of annotated action-classes. If the set of action-classes has changed or there are changes to any of the action-classes, trigger configuration reloading
  • Tapestry 4 plugin, Enables adding new listener methods to Tapestry's Page classes., 3rd party contribution
  • Tapestry 5 plugin, Turns on Tapestry 5 dev mode
  • Thymeleaf Plugin, Disables cache mechanism completely
  • Tiles 1 plugin, Enabled reloading of Tiles definitions from XML configuration files. Implements it by recreating DefinitionsFactory instance when the underlying XML configuration resources have changed., See http://zeroturnaround.com/software/jrebel/how-to-use-jrebel-with-tiles the JRebel+Tiles tutorial
  • Tiles 2 plugin, In Tiles 2.0.x and 2.1.x, monitors XML-files containing Tiles definitions and makes Tiles reload them when there are any changes to those files., For Tiles 2.2.x and 3.0.x, just turns on Tiles's own definitions monitoring and lets it do the job itself., Tested and working also when set up through Spring., See http://zeroturnaround.com/software/jrebel/how-to-use-jrebel-with-tiles/
  • TopLink plugin, Reloads an EntityManagerFactory (SessionFactory) when any of the mapping files or annotated entity classes change., Works with JPA configuration and non-JPA configuration if using org.springframework.orm.toplink.LocalSessionFactoryBean (requires TopLinkSpringPlugin)., , Limitations: Custom non-JPA configuration cannot be supported as we do not know how the configuration was loaded
  • TopLink-Spring Plugin, Reloads a SessionFactory when any of the mapping files or annotated entity classes changes. (Works with non-JPA configuration if using org.springframework.orm.toplink.LocalSessionFactoryBean)., Requires TopLinkPlugin., See http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/orm/toplink/LocalSessionFactoryBean.html for additional details
  • Vaadin CDI utils plugin, Vaadin CDI utils plugin. Prevents creation of duplicate observer methods by org.vaadin.virkki.cdiutils.mvp.MvpExtension
  • Velocity plugin, Velocity has a method cache for its known beans that prevents changes to those beans (new getter methods) to become accessible from associated Velocity templates. The plugin remedies this by triggering a cache rebuild each time a bean accessed by velocity has been reloaded by JRebel., The implementation is fine-grained: cache will be emptied only for the bean that was reloaded
  • VRaptor plugin, Supports adding, modifying and removing controllers with @Resource annotation, Reloads methods marked with @GET, @POST, @DELETE, @PUT, @Path annotations, Works on Guice, Pico, Spring container
  • Weblogic EJB Plugin, description=Supports adding new methods to EJB interfaces.,
  • WebObjects plugin, 3rd contribution by Quinton Dolan, set -Drebel.wo.optimize=true to disable reloading of some common package
  • Websphere EJB Plugin, Supports adding new methods to EJB interfaces
  • Weld 2 plugin, Refreshes Weld class metadata and wires changed dependencies on class change
  • Weld plugin, Refreshes Weld class metadata and wires changed dependencies on class change
  • Wicket plugin, Automatically turns on Wicket's HTML template reloading., Tells Spring to try refreshing its context when Spring bean lookup operations fail., Listens for class reload events. When received, cleans Wicket's class metadata caches for the reloaded classes that cache the @SpringBean annotations, forcing Wicket to reload the metadata and enabling annotations to take effect., See the <a href="/http://zeroturnaround.com/software/jrebel/how-to-use-jrebel-with-wicket/">JRebel+Wicket tutorial</a>
  • Wink plugin, Reloads changes in configuration files and application, resource and provider classes
  • ZK Framework plugin, Integrates with ZK Framework cache

Future version of java?

There is hope to have support (JEP 159) for the addition of super-types and the addition and removal of methods and fields.

Reference: Java Whitepaper 135217: Reliability, Availability and Serviceability

You might like also

#ALPINE-HACK19 4 – 5 October, 2019
On October 4th and 5th, the AlpineHack19 will be held, a blockchain-themed hackathon. The opportunity to bring together software developers, hackers, information technology enthusiasts and SMEs to showcase their know-how. The aim for the participants is to develop a functioning open-source software or #hardware prototype – solutions that eliminate real problems, for real companies. #Blockchain Technology will be the center of all predefined challenges. 24 hours of #Innovation, personal development and lots of fun. I will be there as hackathon mentor …
48 Days ago
CryptoMountain Rocks in Sion 3-5 october 2019
CryptoMountain Rocks is a platform for Blockchainers from the Crypto Valley and beyond that offers a very inter-active conference with presentations, panels and talks battles. I will be there 3 days as a speaker and hackathon mentor. The event discusses latest Blockchain applications and talks about the impact of the new token economy on the way we do business. In parallel there will be the first CryptoMountain Rocks #ALPINE-HACK19 covering themes such as Agriculture, Energy and Supply Chain. …
48 Days ago
A git workflow that is easy and scale for product development
There are numerous GIT workflow floating around like Centralized Workflow, Gitflow, Forking flow and Feature Branch Workflow Over the last 10 years, I have followed this really simple workflow, similar to the forking flow. it allow Parallel Development, features branches can be merged to any release branches or ideally Master Collaboration Feature branches also make it easier for two or more developers to collaborate on the same feature We consider Master the stable version of the product, this branch should be deployed automatically using …
72 Days ago
Using free Cloudflare for CDN and DDoS protection
Cloudflare, Inc. is an American web infrastructure and website security company, providing content delivery network services, DDoS mitigation, Internet security, and distributed domain name server services.  It will cost you 0$ (DDOS, CDN) to 20$ or more and offer you the following advantages DDoS is short for Distributed Denial of Service. DDoSis a type of DOS attack where multiple compromised systems, which are often infected with a Trojan, are used to target a single system causing a Denial of Service …
72 Days ago
Add Docker container logs in Splunk
With Splunk You will be able to optimize container usage by monitoring CPU, memory, disk and network performance metrics from your containers. Pay only for what you need by managing resources and measuring the impact on service reliability and container resource requirements. Get a complete overview of Kubernetes and OpenShift Environments Correlate performance metrics, container logs and OpenShift/Kubernetes configuration and metadata for a better understanding of how your infrastructure is performing and how hosted applications are behaving. …
72 Days ago
Installing latest Splunk in 5 minutes using Docker
From 0 to Splunk in 5 minutes using Docker and Compose Splunk is an American multinational corporation headquartered in San Francisco, California, which produces software for searching, monitoring, and analyzing machine-generated big data, via a web-style interface. Docker is an open source software platform to create, deploy and manage virtualized application containers on a common operating system (OS), with an ecosystem of allied tools.  Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with …
72 Days ago
Explore 142 Initial Exchange Offering  (IEO) by category, year and country
IEO is currently the most popular fundraising trend in the crypto industry. As the name suggests, Initial Exchange Offering is conducted over the crypto trading platform and exchanges. So unlike ICOs wherein crypto projects directly approach investors, IEOs involve a third-party in the form of crypto exchanges. …
166 Days ago
Security Token Offering (STO) statistics
Security token offering (STO) is a type of fundraising that is performed with a company offering tokenized securities. The defining feature of security token offerings is in its definition. Stocks, bonds and managed property trusts are another examples of securities. …
167 Days ago
systematization of knowledge within major blockchain protocols or consensus
Alexis Gauba presented a systematization of knowledge within major blockchain protocols or consensus, addresses the common challenges …
245 Days ago
Stablecoins: Crypto's Holy Grail or Fools’ Errand? by Dr Garrick Hileman
I was attending the interesting LECTURE "Stablecoins: Crypto's Holy Grail or Fools’ Errand?" by Dr Garrick Hileman - Head of reseach at Blockchain - London School of Economics - United Kingdom at hashtag#ETH hashtag#Zurich and here is a copy of the slides Introducing: 2019 State of Stablecoins The 2019 report builds on its predecessor to provide an updated and expanded look at the current state of the stablecoin market - a space where we expect to see significant innovation in …
245 Days ago