Search code examples
javaxmlweblogic-10.xzipinputstreamzipoutputstream

.war file created using ZipOutputStream fails to deploy


I am reading a .war file and after reading it into a ZipInputStream , i edit the web.xml and add weblogic.xml - and then transfer all this into ZipOutputStream , which i write as the final output.war file.

The problem that i am facing is , the output.war is not deployable in WLS . Its not giving any errors. it is showing that the web app is active , but on access i get ERROR 403.

But if i open the .war file using any archiver say winzip , edit the web.xml and weblogic.xml , then i am able to deploy .(By edit i mean , just delete a space somewere and save again - no changes) .

Any idea why this could be happening ? Edit and saving the xmls , would prob change the FORMAT or ENCODING tye ? is that the reason ?

(usig weblogic 10.3.3)


Solution

  • While you can read JARs using a ZipInputStream, you can't write them with a ZipOutputStream. You need to use a JarOutputStream, otherwise what you create won't be a JAR, it'll be a ZIP, and it won't deploy.

    JARs are ZIPs with some extra meta-data, so they can be read as ZIPs, but need to be created with a special tool.