JBoss EAPJakarta EEJava 21企業系統升級

JBoss EAP 02: WAR, EAR, and the path to a working API

··4 min read
Back to the JBoss EAP learning path

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.

Five layers from top to bottom: artifact, deployment, web context, proxy and listener, Spring mapping, each with the evidence to check; a note warns that a runtime-name without .war registers no web context
Five layers from file to API. Each layer needs its own evidence; an OK on one layer does not stand in for the next. Diagram drawn by KeepOnFirst.

Packaging defines boundaries

FormatTypical contentsOwner
WARWeb classes, WEB-INF/lib, descriptorsEAP web container and application framework
EAREnterprise modules and shared librariesEAP enterprise deployment
RARAdapter connecting an external systemEAP resource-adapters subsystem
Executable Boot JARApplication and executable launch layoutIts own JVM launch process
Extensions describe different roles; renaming does not convert them.

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.

java
@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

text
# Read a local artifact you already built.
jar tf orders.war
shasum -a 256 orders.war

# Separately, in an authorized standalone training CLI:
deployment info

Keep 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.

text
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.

text
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.

ColumnOfficial exampleWhat it answers
NAMEtest-application.warDeployment name in the management model
RUNTIME-NAMEtest-application.warruntime-name; the default path comes from it
PERSISTENTtrueNot covered here; record the value as is
ENABLEDtrueWhether the deployment is enabled
STATUSOKCurrent state of the deployment
deployment info columns: official example values and what each answers

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.

LayerCheck firstAn OK here still does not prove
1 Artifactjar tf listing, SHA-256The server runs the same file
2 DeploymentENABLED and STATUS in deployment infoThe web context is registered
3 Web contextWFLYUT0021 in the server log, end of RUNTIME-NAMEThe proxy sends requests here
4 Proxy and listenerOne request ID in both logsThe controller path matches
5 Spring mappingStatus, body, data side effectsOther order cases are correct
404 checklist: record evidence for each layer before moving down

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

Sources