How to create a singleton deployment in EAP7

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x

Issue

  • Is the HA Singleton deployment shown in this article supported in EAP7?
  • what is the purpose of the META-INF/singleton-deployment.xml
  • How can I deploy my application as a HA-Singleton in a cluster, I need to have this deployed only at one node

Resolution

Applications which are marked as singleton-deployment in EAP7 are started only from one node in a cluster.
It is possible to add simple election policies within the configuration, see the EAP 7 developer guide

Note:

Applications marked with singleton-deployment are started on multiple nodes if

  • the cluster can't be established because of configuration or network issues
  • a non HA configuration (standalone.xml (default), standalone-full.xml or domain profile "default" or "full") is used.

application deployed as WAR or JAR

The singleton-deployment.xml or jboss-all.xml must be included in the /META-INF folder at the top-level of the archive.

If maven WAR plugin is used the file can be placed in **/src/main/webapp/META-INF to add it.

application deployed as EAR

If an application is deployed as an EAR file either the singleton-deployment.xml or jboss-all.xml must be located at the top level META-INF folder of the ear. Any occurrence in sub-deployments are ignored!

Important
If a non-cluster configuration is used the singleton-deployment.xml will be ignored and the application will be deployed successfully.
The jboss-all.xml will fail with a parser error "Unexpected element '{urn:jboss:1.0}singleton-deployment'". This is because the singleton subsystem is not available by default in non HA configurations. The recommendation is to use the singleton-deployment.xml descriptor if it is necessary to deploy in both environments.

Related articles

  • If invocation of EJB applications deployed as HASingleton with automatic client side is needed with 7.0 or 7.1.BETA see this solution
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.