Free WAR test files and sample generator
A Java web application archive: a ZIP with WEB-INF/web.xml and a manifest. Generate valid .war sample files to test deployment tooling and servlet containers.
What is a .war file?
WAR: Java Web Archive. A WAR is a Java web application archive, a ZIP with WEB-INF/web.xml and the classes and resources a servlet container needs to deploy the app.
Why generate a test WAR file?
- Test a deployment pipeline that pushes WARs to a servlet container.
- Verify web.xml parsing and archive layout.
- Check artifact size limits in CI.
What you can put inside a .war file
You get 3 content options for WAR, so the file holds something meaningful rather than random padding: Text files, Mixed file types, Many small files. For WAR these are alternatives, so choose the one that matches what you need to test.
How a .war file is identified
Every .war file begins with 50 4B 03 04, the ASCII letters "PK", the initials of Phil Katz, who created the ZIP format. That is what a validator inspecting content rather than the file name looks for.
How the size lands on the exact byte
The package is a ZIP, so the padding is trailing whitespace inside one of the XML parts it already contains. Extractors and Office readers both ignore it, so the document opens unchanged.
Negative testing with broken WAR files
- Invalid. Identifiable, but wrong inside, so it fails during parsing.
- Corrupted. The leading bytes are destroyed, so the
50 4B 03 04identifying a .war is gone. Same length as the valid file. - Incomplete. Truncated part-way, so it is genuinely shorter.
- Empty. Chosen under Content rather than File Condition: valid structure, no data.
Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation.
Sample WAR content
[WAR], ZIP container: META-INF/MANIFEST.MF + WEB-INF/web.xml + resources.
This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.
How to open and verify the file
List with `jar tf file.war`; deploy to Tomcat's webapps directory to test for real.
Media type application/java-archive · extension .war · category Archives
Generate a .war file → · questions about sizes, privacy or cost are answered on the site FAQ.
Frequently asked questions about WAR files
What identifies a .war file?
A .war file begins with the bytes 50 4B 03 04, the ASCII letters "PK", the initials of Phil Katz, who created the ZIP format. Those bytes are what a content-sniffing validator looks for, and what the Corrupted condition destroys.
How can a .war file be an exact number of bytes?
The package is a ZIP, so the padding is trailing whitespace inside one of the XML parts it already contains. Extractors and Office readers both ignore it, so the document opens unchanged.
What can go inside the WAR file?
There are 3 content options for .war: Text files, Mixed file types, Many small files. For WAR these are alternatives, so pick the one matching what you need to test.
Can I download several broken WAR files at once?
Yes, select more than one File Condition and you get one ZIP containing a .war per condition, each named after its condition.
Can the WAR file use UTF-16 or a byte-order mark?
No, and deliberately. A .war file is a container rather than plain text, so rewriting its bytes as UTF-16 would not produce a UTF-16 document. It would produce a broken file. Use a text format such as CSV, JSON or XML for encoding tests.
How do I open or verify the WAR file?
List with jar tf file.war; deploy to Tomcat's webapps directory to test for real.