Return to site

📦🌐 WAR FILES: WHAT’S TRUE (AND WHAT’S A MYTH)?

· jakartaee,java,certification,programmmer

🔸 TL;DR

A .war is basically a JAR-shaped archive for web apps. web.xml is optional (but has a strict location if present), you can build a WAR with jar, and EJBs can live inside a WAR. JCA resource adapters? Not inside a WAR.

Section image

🔸 QUIZ TIME (PICK 2 ✅)

Which statements are true about WAR (.war) files?

▪️ A) A WAR must include a web.xml file inside WEB-INF/.

▪️ B) You can create a WAR using the jar command/tool.

▪️ C) You can package JCA resource adapters inside a WAR.

▪️ D) You can package EJBs inside a WAR.

(Stop here and pick 2 😉)

🔸 ANSWER KEY ✅

✅ B) Yes — A WAR is essentially a ZIP/JAR-style archive, so the jar tool can package it. (war is just an extension + conventions.)

✅ D) Yes — EJBs can be included in a WAR, either:

▪️ as classes in WEB-INF/classes/

▪️ or as JARs in WEB-INF/lib/

❌ A) No — web.xml is not mandatory anymore (annotations + programmatic config exist).

But if you do include it, it must be located at:

▪️ WEB-INF/web.xml

❌ C) No — JCA resource adapters are packaged as RAR files and handled at the application server level, not bundled inside a WAR.

🔸 TAKEAWAYS 🧠

▪️ WAR = “web module archive” with standard folders like WEB-INF/

▪️ web.xml is optional, but location rules are strict if used

▪️ WAR packaging can be done with jar (same underlying format idea)

▪️ EJB-in-WAR is valid in Jakarta EE / Java EE deployments

▪️ JCA adapters ≠ WAR content (think RAR + server-managed)

#Java #JakartaEE #JavaEE #Spring #EnterpriseJava #ApplicationServer #Tomcat #WildFly #Payara #WebDevelopment #SoftwareArchitecture #Certification #BackendEngineering

Go further with Java certification:

Java👇

Spring👇

SpringBook👇