question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Manifest Format when processing .war by Tomcat

See original GitHub issue

Context

  • MapFish print version: 3.26, 3.25, 3.24.2 .war file from github release
  • Java version: OpenJDK 11
  • Tomcat 8.5 64 bit
  • OS: Windows 10

Describe the bug

After copying the war file into webapps the processing fails.

26-Oct-2020 15:19:50.490 INFO [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\print-servlet-3.26.0.war]
26-Oct-2020 15:19:52.879 WARNING [localhost-startStop-2] org.apache.catalina.webresources.DirResourceSet.initInternal Failed to read manifest from [C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\print-servlet-3.26.0\META-INF\MANIFEST.MF]
	java.io.IOException: invalid manifest format
		at java.base/java.util.jar.Manifest.read(Manifest.java:257)
		at java.base/java.util.jar.Manifest.<init>(Manifest.java:80)
		at java.base/java.util.jar.Manifest.<init>(Manifest.java:72)
		at org.apache.catalina.webresources.DirResourceSet.initInternal(DirResourceSet.java:272)
		at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
		at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:714)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4816)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4951)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
		at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
		at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1841)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
		at java.base/java.lang.Thread.run(Thread.java:834)
26-Oct-2020 15:20:02.188 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.startInternal Error while attempting to validate required application extensions
	java.io.IOException: invalid manifest format

How to reproduce

Copy the war file into webapps.

Expected results

I expected the war file to work.

The MANIFEST.MF contains

Manifest-Version: 1.0
Build-Java-Runtime-Name: OpenJDK Runtime Environment
Build-OS-Name: Linux
Mapfish-Print-Version: 3.24.2
Build-Time: 10/21/20 10:03:24 AM
Build-OS-Arch: amd64
Git-Revision: 90dea2966b0c4b746078bf80848576e13769d0f9

Build-By: runner
Build-Java-Version: 1.8.0_265


I tested a GeoServer .war, which is the only other package I am familiar with, and it installs fine.

Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jwkaltzcommented, Jan 8, 2021

As a quick fix, you can unzip the war, remove the empty line in /var/lib/tomcat9/webapps/mapfish/META-INF/MANIFEST.MF, and rezip the war

(see also here: https://github.com/mapfish/mapfish-print/issues/1545#issue-731163197)

0reactions
teofilosalgadocommented, Jan 8, 2021

@jwkaltz Thank you! Removing the empty lines allowed the deploy to proceed flawlessly! I just needed to add a print-apps folder inside the directory generated by the .war deploy in order to start the service. source

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix `java.io.IOException: invalid manifest format ...
IOException: invalid manifest format (Webservice)` with Wildfly 10? ... to process phase STRUCTURE of deployment "axiswebservice.war" at ...
Read more >
java error with latest version (1.7.6) · Issue #71 - GitHub
MF] java.io.IOException: invalid manifest format at java.util.jar.Manifest.read(Unknown Source) at java.util.jar.Manifest.
Read more >
java.io.IOException: invalid manifest format Error while ...
Hi while jar file creatiion i got this error. D: \myframe>jar cmf MyFrame.mft MyFrame.jar *.class java.io.IOException: invalid manifest ...
Read more >
Tomcat and MANIFEST.MF Class-Path section - CodeRanch
MF entry in the WAR file listing all extensions needed by the WAR. The format of the manifest entry should follow standard JAR...
Read more >
WAR Files and Deployment - Learning Java, 4th Edition [Book]
Tomcat automatically reloads WAR files when they change them (unless configured not to), so all you have to do is drop an updated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found