JBoss EAP 02: WAR, EAR, and the path to a working API
An uploaded orders.war still returns 404. “Deployed” hides several states: content exists, deployment is enabled, a web context started, and the request reached the correct route. Trace those stages before changing code.
Version note: this series is based on JBoss EAP 8.1. The Red Hat documentation site now lists a newer 8.2 Beta, which is not a GA release. For version differences, see the Red Hat EAP documentation home in the sources.
Packaging defines boundaries
| Format | Typical contents | Owner |
|---|---|---|
| WAR | Web classes, WEB-INF/lib, descriptors | EAP web container and application framework |
| EAR | Enterprise modules and shared libraries | EAP enterprise deployment |
| RAR | Adapter connecting an external system | EAP resource-adapters subsystem |
| Executable Boot JAR | Application and executable launch layout | Its own JVM launch process |
A WAR keeps classes in WEB-INF/classes and libraries in WEB-INF/lib. An EAR can contain WARs, EJB modules, and shared libraries with different visibility rules. Moving all JARs to one directory does not preserve those rules. An adapter is not a renamed MQ client JAR.
Boot inside EAP changes startup ownership
The Boot series launched an embedded server with java -jar. External deployment requires WAR packaging, SpringBootServletInitializer, and appropriate container dependency scopes. This excerpt illustrates the startup bridge; imports and build configuration are omitted, so it is not a complete deployment sample.
@SpringBootApplication
public class OrdersApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(OrdersApplication.class);
}
}Marking embedded Tomcat as provided is part of Boot’s documented WAR workflow. EAP logging, persistence, transaction, and module ownership still need decisions. Producing a WAR does not certify a vendor-supported combination. This traditional WAR route does not apply to WebFlux applications.
Connect artifact, deployment, and URL
# Read a local artifact you already built.
jar tf orders.war
shasum -a 256 orders.war
# Separately, in an authorized standalone training CLI:
deployment infoKeep the artifact hash so identically named WARs are not mistaken for the same build. Record deployment and runtime names, enablement, status, and startup logs, then find the actual context root. Descriptors or configuration may override naming defaults. Separate proxy prefix, web context, and controller mapping.
Client URL → proxy route → EAP listener
→ web context → Spring mapping → business method
Example only: /public/orders/api/42
Actual prefix and context must be observed.Official example: what a good deployment looks like
Red Hat’s EAP 8.1 deployment guide uses test-application.war as its example. After a CLI deployment, the server log shows the three lines below. The first starts the deployment, the second registers the web context, and the third reports completion.
WFLYSRV0027: Starting deployment of "test-application.war" (runtime-name: "test-application.war")
WFLYUT0021: Registered web context: /test-application
WFLYSRV0010: Deployed "test-application.war" (runtime-name : "test-application.war")The /test-application path in the second line is the file name without .war. That is the concrete case behind “the file name can set the default path.” If WFLYUT0021 is missing from the log, no path exists yet, so do not blame the Spring mapping first.
| Column | Official example | What it answers |
|---|---|---|
| NAME | test-application.war | Deployment name in the management model |
| RUNTIME-NAME | test-application.war | runtime-name; the default path comes from it |
| PERSISTENT | true | Not covered here; record the value as is |
| ENABLED | true | Whether the deployment is enabled |
| STATUS | OK | Current state of the deployment |
This table answers layer 2 only. STATUS OK does not prove the web context is registered or that the proxy sends requests to this server. Read the table and the log together, and record each in the workbook.
runtime-name without .war: the web context is not registered
The official guide adds a note next to the deploy command. When you set a runtime-name with --runtime-name, the name must include the .war extension. Without it, JBoss EAP does not register the web context. The deployment still appears in the list, but layer 3 has no path, so requests cannot reach the application.
The guide says only that the web context is not registered. It gives no HTTP status code. The 404 is inferred from that, so rely on the actual response.
Check two things in order. First, the end of RUNTIME-NAME in deployment info. Then WFLYUT0021 in the server log. Only when both are right, move on to the proxy and mapping. If your deployment script sets custom names, put this check in the script instead of reading logs later.
Exercise: OK status, HTTP 404
Record what is known—management reports OK—and what remains unknown: context, proxy forwarding, and mapping. Do not start by repackaging. Correlate the request across proxy and application logs, then inspect context and routing. A health endpoint responding does not establish order behavior; verify response and side effects with an order case.
| Layer | Check first | An OK here still does not prove |
|---|---|---|
| 1 Artifact | jar tf listing, SHA-256 | The server runs the same file |
| 2 Deployment | ENABLED and STATUS in deployment info | The web context is registered |
| 3 Web context | WFLYUT0021 in the server log, end of RUNTIME-NAME | The proxy sends requests here |
| 4 Proxy and listener | One request ID in both logs | The controller path matches |
| 5 Spring mapping | Status, body, data side effects | Other order cases are correct |
For each layer, write only evidence you saw yourself. If a layer has no evidence, write “unknown”; do not borrow the OK from the layer above. The first “unknown” in the table is where you look next.
Download the EAP offline kit: inventory, exercises, workbookNext: 03: Modules and JakartaLesson 08: build and inspect a Spring Boot WAR