0

I am trying to deployin a .war file from my computer after modifing one file

  • I Extract the file META-INF/context.xml using :

    jar xf ROOT.war META-INF/context.xml

  • I added some code lines to the file Context.xml

  • I Update the war file with modified META-INF/context.xml using this command :

    jar uf ROOT.war META-INF/context.xml

  • But i get this ERROR :

    at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:232)
    at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
    at sun.tools.jar.Main.update(Main.java:635)
    at sun.tools.jar.Main.run(Main.java:271)
    at sun.tools.jar.Main.main(Main.java:1288)```
    
    

Any Ideas, please!

AissamR38
  • 5
  • 4
  • That is not the entire error message, please include the whole stacktrace in the question. Anyway a WAR is not necessarily a JAR, so you should use `zip` instead of `jar`. – Piotr P. Karwasz Feb 22 '22 at 13:40

2 Answers2

0

Re: the comment from @PiotrP.Karwasz, jar should work just fine with a war file. The only difference between a war and a jar is their structure. But he is right that you can use zip as well as as jar to manipulate the war file, which could give you a better result.

To extract the context.xml:

unzip ROOT.war META-INF/context.xml

To update the war with your modified context.xml:

zip ROOT.war META-INF/context.xml

Also, if you're deploying on Tomcat 8, XNAT has been configured to work on Tomcat 8.5/9 by default since v1.8.2. If you can upgrade from your current version to the latest release (we just released 1.8.4), you won't have to do anything to get the war to work with Tomcat 8.5 or 9.

Spanky Quigman
  • 870
  • 7
  • 16
0

Hello to all I come back to you after my question, I managed to deploy a war with zip. and jar too, Indeed my error is due to the fact that there are two jar files in /lib that have the same name (weird),
I deleted the files then I copy/paste only one and it worked.

with zip i used this steps :

1: unzip ROOT.war META-INF/context.xml

2: zip ROOT.war META-INF/context.xml

AissamR38
  • 5
  • 4