Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBoss EAP 6.x understand the deployment phase - ResourceAdapters, EJB, jar, war

In JBoss, how is the sequence of the deployment phase? What is the order of object being instantiated and available to use? Considering an enterprise application (*.ear), inspecting all deployment log (server.log) the deployment phase looks like:

  1. All libs are deployed - .class files are loaded and available;
  2. All *.jar modules are deployed - .class files are loaded and available;
  3. If some *.jar is an EJB Jar, through the configuration files (Ex. ejb-jar.xml) or annotations, the JNDI tree is created;
  4. If some *.jar has a persistence.xml file configuration, all entity and link to datasources are loaded;
  5. All *.war modules start the deploy phase;
  6. Through configuration files (web.xml), listeners and context-root are loaded and eventually security aspects.
  7. Ear deployed successful.

Questions:

  • What about the resource adapters modules, the PersistenceContext and the EJB Pool?
  • When a persistence.xml is found, does a connection to the data-source and so to the DB pool start?
  • Since the datasource (DB) is configured in the standalone.xml or domain.xml, when happens the first connection to the DB pool? When I inject the PersistenceContext and use the EntityManager?
  • When the EJB pool is loaded and available to use?
  • Is correct to say that during the EJB jar deploy, the JNDI tree is created and then available?
  • When an EJB is discovered, it's loaded inside the pool (as reference to inject/lookup)?

When a .war module is deployed and ready, even if the full deploy of the .ear is not completed yet, possibly servlet or listener are started from the container.

  • What happens if some of this objects (listener, servlet) try to use EJBs or PersistenceContext or other objects? Are those objects available?
  • Is it possible to have deadlock problem and hang the deployment thread/phase?
like image 985
StarsSky Avatar asked Jul 04 '15 11:07

StarsSky


People also ask

Where are war file deployed in JBoss?

war . Paste the files in the following location: For JBoss single node, <JBoss-DIR>\standalone\deployments .

How do you deploy a war in JBoss EAP 7?

From the JBoss bin directory, run the command jboss-cli --connect to start the JBoss CLI and connect to the application server. Run the /deployment command on the compressed WAR file or exploded WAR folder. [If you are deploying to a managed domain, also run the /server-group command.]

What is JBoss deployment?

Deployment is the term used for the process of installing a web application (either a 3rd party WAR or your own custom web application) into the JBoss Web server.

What is auto deployment in JBoss?

Automatic application deployment is a simple process that consists of dropping an application into the deployments folder, which is located in the path JBOSS_HOMEstandalonedeployments. By default, every application archive (WAR, JAR, EAR, and SAR) that is placed into this folder is automatically deployed on the server.


1 Answers

  • It is possible to control the deployment order of jars and wars in application.xml using <initialize-in-order>true</initialize-in-order>
  • The lifecycle of the resource adapters is controlled by the connector architecture
  • The lifecycle of Container-Managed Entity Managers are managed by JBoss. Assuming you are injecting into an EJB using @PersistenceContext, this happens prior to @PostConstruct.
  • Singleton EJB initialization order can be defined using @DependsOn("OtherBean")
  • You can ensure the EJB endpoints are available using the deployment order in the first bullet
  • Not sure if it is possible to dead lock - it is far more likely that you will see a JNDI exception
like image 143
Chris K Avatar answered Oct 22 '22 00:10

Chris K