Skip to content

Latest commit

 

History

History
104 lines (77 loc) · 4.34 KB

README.adoc

File metadata and controls

104 lines (77 loc) · 4.34 KB

ejb-in-war: Deployment of a WAR Containing an EJB

The ejb-in-war quickstart demonstrates how to package an EJB bean in a WAR archive and deploy it to {productName}. Arquillian tests are also provided.

What is it?

The ejb-in-war quickstart demonstrates the deployment of an EJB bean bundled in a WAR archive for deployment to {productNameFull}. The project also includes a set of Arquillian tests for the managed bean and EJB.

The example follows the common "Hello World" pattern using the following workflow.

  1. A JSF page asks for the user name.

  2. On clicking Greet, the name is sent to a managed bean named Greeter.

  3. On setting the name, the Greeter invokes the GreeterEJB, which was injected into the managed bean. Notice the field annotated with @EJB.

  4. The response from invoking the GreeterEJB is stored in a field message of the managed bean.

  5. The managed bean is annotated as @SessionScoped, so the same managed bean instance is used for the entire session. This ensures that the message is available when the page reloads and is displayed to the user.

Access the Application

Investigate the Console Output

When you run the Arquillian tests, Maven prints summary of the performed tests to the console. You should see the following results.

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

If you are interested in more details, check target/surefire-reports directory. You can check console output to verify that Arquillian has really used the real application server. Search for lines similar to the following ones in the server output log:

INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "test.war" (runtime-name: "test.war")
...
INFO  [org.jboss.as.server] (management-handler-thread - 29) WFLYSRV0010: Deployed "test.war" (runtime-name : "test.war")
...
INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment test.war (runtime-name: test.war) in 12ms
...
INFO  [org.jboss.as.server] (management-handler-thread - 30) WFLYSRV0009: Undeployed "test.war" (runtime-name: "test.war")