← Back to team overview

dhis2-users team mailing list archive

Re: WAR file cannot deploy in tomcat 8

 

Because a war file is just a zip file in disguise, it can be a good idea to
test the file before deploying.  That way at least you know that you have
one source of potential errors covered and you are not trying to deploy a
broken file.

This what I do with my deploy script at
https://github.com/dhis2/dhis2-tools/blob/master/dhis2-tools/dhis2-tools/usr/bin/dhis2-deploy-war

The relevant line being:
unzip -tq $TEMPWAR || { echo "Corrupt war file: $TEMPWAR"; exit 1; }

On windoze you can probably just test with whatever gui tool you use.
Maybe needing to rename file extension to .zip.

Just one small tip trying to stay one step ahead of the universe which
might be out to get you :-)

On 3 March 2017 at 16:51, Calle Hedberg <calle.hedberg@xxxxxxxxx> wrote:

> Hannan,
>
> Just take it as proof that the universe is out to get you!
>
> Regards
> Calle
>
> On 3 March 2017 at 11:23, Hannan Khan <hannank@xxxxxxxxx> wrote:
>
>> Thanks guys problem resolved.
>>
>> The reason was corrupt war file. But it is quite odd I download twice
>> (with two hour difference), both are corrupt.
>>
>> The third one is OK, but all thre showing same size.!!!!
>>
>> Regards
>>
>> Hannan
>>
>> On Thu, Mar 2, 2017 at 2:57 PM, Calle Hedberg <calle.hedberg@xxxxxxxxx>
>> wrote:
>>
>>> Hannan
>>>
>>> I've been running all versions from 2.17 to 2.27 on the same platform
>>> (java 8 build 121, tomcat 8.0.33 and 36) - no problems. So I agree with Bob
>>> - looks like a damaged war file.
>>>
>>> Regards
>>> Calle
>>>
>>> On 2 March 2017 at 08:09, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
>>>
>>>> Looks like a damaged war file (hence the zip exceptions when it tries
>>>> to extract).
>>>>
>>>> Please try and download again or try with a known good war file.
>>>>
>>>> On 2 March 2017 at 11:35, Hannan Khan <hannank@xxxxxxxxx> wrote:
>>>>
>>>>> Thanks bob for quick response.
>>>>>
>>>>> Java:
>>>>> java version "1.8.0_121"
>>>>> Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
>>>>> Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
>>>>>
>>>>> And log:
>>>>>
>>>>> 02-Mar-2017 11:29:07.031 INFO [localhost-startStop-2]
>>>>> org.apache.catalina.startup.HostConfig.deployWAR Deploying web
>>>>> application archive /opt/tomcat/webapps/dhis.war
>>>>> 02-Mar-2017 11:29:07.604 SEVERE [localhost-startStop-2]
>>>>> org.apache.catalina.startup.ContextConfig.beforeStart Exception
>>>>> fixing docBase for context [/dhis]
>>>>>  java.util.zip.ZipException: invalid literal/lengths set
>>>>> at java.util.zip.InflaterInputStream.read(InflaterInputStream.j
>>>>> ava:164)
>>>>> at java.io.FilterInputStream.read(FilterInputStream.java:107)
>>>>> at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:381)
>>>>> at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:165)
>>>>> at org.apache.catalina.startup.ContextConfig.fixDocBase(Context
>>>>> Config.java:619)
>>>>> at org.apache.catalina.startup.ContextConfig.beforeStart(Contex
>>>>> tConfig.java:752)
>>>>> at org.apache.catalina.startup.ContextConfig.lifecycleEvent(Con
>>>>> textConfig.java:308)
>>>>> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
>>>>> (LifecycleSupport.java:95)
>>>>> at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(Li
>>>>> fecycleBase.java:90)
>>>>> at org.apache.catalina.util.LifecycleBase.setStateInternal(Life
>>>>> cycleBase.java:394)
>>>>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.j
>>>>> ava:144)
>>>>> at org.apache.catalina.core.ContainerBase.addChildInternal(Cont
>>>>> ainerBase.java:725)
>>>>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBas
>>>>> e.java:701)
>>>>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.
>>>>> java:717)
>>>>> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.
>>>>> java:940)
>>>>> at org.apache.catalina.startup.HostConfig$DeployWar.run(HostCon
>>>>> fig.java:1816)
>>>>> at java.util.concurrent.Executors$RunnableAdapter.call(Executor
>>>>> s.java:511)
>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>> Executor.java:1142)
>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>> lExecutor.java:617)
>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>
>>>>> 02-Mar-2017 11:29:08.147 SEVERE [localhost-startStop-2]
>>>>> org.apache.catalina.core.ContainerBase.addChildInternal
>>>>> ContainerBase.addChild: start:
>>>>>  org.apache.catalina.LifecycleException: Failed to start component
>>>>> [StandardEngine[Catalina].StandardHost[localhost].StandardCo
>>>>> ntext[/dhis]]
>>>>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.j
>>>>> ava:153)
>>>>> at org.apache.catalina.core.ContainerBase.addChildInternal(Cont
>>>>> ainerBase.java:725)
>>>>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBas
>>>>> e.java:701)
>>>>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.
>>>>> java:717)
>>>>> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.
>>>>> java:940)
>>>>> at org.apache.catalina.startup.HostConfig$DeployWar.run(HostCon
>>>>> fig.java:1816)
>>>>> at java.util.concurrent.Executors$RunnableAdapter.call(Executor
>>>>> s.java:511)
>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>> Executor.java:1142)
>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>> lExecutor.java:617)
>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>> Caused by: java.lang.IllegalStateException:
>>>>> java.util.zip.ZipException: invalid entry size (expected 7165 but got 45246
>>>>> bytes)
>>>>> at org.apache.catalina.webresources.JarWarResourceSet.getArchiv
>>>>> eEntries(JarWarResourceSet.java:119)
>>>>> at org.apache.catalina.webresources.AbstractArchiveResourceSet.
>>>>> getResource(AbstractArchiveResourceSet.java:256)
>>>>> at org.apache.catalina.webresources.StandardRoot.getResourcesIn
>>>>> ternal(StandardRoot.java:327)
>>>>> at org.apache.catalina.webresources.CachedResource.validateReso
>>>>> urces(CachedResource.java:124)
>>>>> at org.apache.catalina.webresources.Cache.getResources(Cache.java:150)
>>>>> at org.apache.catalina.webresources.StandardRoot.getResources(S
>>>>> tandardRoot.java:315)
>>>>> at org.apache.catalina.webresources.StandardRoot.getClassLoader
>>>>> Resources(StandardRoot.java:231)
>>>>> at org.apache.catalina.util.ExtensionValidator.validateApplicat
>>>>> ion(ExtensionValidator.java:145)
>>>>> at org.apache.catalina.core.StandardContext.startInternal(Stand
>>>>> ardContext.java:5111)
>>>>> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.j
>>>>> ava:147)
>>>>> ... 10 more
>>>>> Caused by: java.util.zip.ZipException: invalid entry size (expected
>>>>> 7165 but got 45246 bytes)
>>>>> at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:384)
>>>>> at java.util.zip.ZipInputStream.read(ZipInputStream.java:196)
>>>>> at java.util.jar.JarInputStream.read(JarInputStream.java:207)
>>>>> at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:140)
>>>>> at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:118)
>>>>> at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:142)
>>>>> at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.
>>>>> java:179)
>>>>> at org.apache.catalina.webresources.JarWarResourceSet.getArchiv
>>>>> eEntries(JarWarResourceSet.java:112)
>>>>> ... 19 more
>>>>>
>>>>> 02-Mar-2017 11:29:08.148 SEVERE [localhost-startStop-2]
>>>>> org.apache.catalina.startup.HostConfig.deployWAR Error deploying web
>>>>> application archive /opt/tomcat/webapps/dhis.war
>>>>>  java.lang.IllegalStateException: ContainerBase.addChild: start:
>>>>> org.apache.catalina.LifecycleException: Failed to start component
>>>>> [StandardEngine[Catalina].StandardHost[localhost].StandardCo
>>>>> ntext[/dhis]]
>>>>> at org.apache.catalina.core.ContainerBase.addChildInternal(Cont
>>>>> ainerBase.java:729)
>>>>> at org.apache.catalina.core.ContainerBase.addChild(ContainerBas
>>>>> e.java:701)
>>>>> at org.apache.catalina.core.StandardHost.addChild(StandardHost.
>>>>> java:717)
>>>>> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.
>>>>> java:940)
>>>>> at org.apache.catalina.startup.HostConfig$DeployWar.run(HostCon
>>>>> fig.java:1816)
>>>>> at java.util.concurrent.Executors$RunnableAdapter.call(Executor
>>>>> s.java:511)
>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>> Executor.java:1142)
>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>> lExecutor.java:617)
>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Mar 2, 2017 at 11:58 AM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>
>>>>> wrote:
>>>>>
>>>>>> Hi Hannan
>>>>>>
>>>>>> There is not sufficient info in this message to be able to help.  We
>>>>>> know from your report that it failed to start.  You need to look earlier in
>>>>>> the logfile for why it failed to start.  Also the java version might be
>>>>>> helpful.
>>>>>>
>>>>>> Bob
>>>>>>
>>>>>> On 2 March 2017 at 11:24, Hannan Khan <hannank@xxxxxxxxx> wrote:
>>>>>>
>>>>>>> Dear All
>>>>>>>
>>>>>>> I just update one server to tomcat8 (version 8.0.36) but not able to
>>>>>>> deploy war file (dhis2 version 23) the error message is following. I never
>>>>>>> have this message before. I need immediate help.
>>>>>>>
>>>>>>> FAIL - Encountered exception org.apache.catalina.LifecycleException:
>>>>>>> Failed to start component [StandardEngine[Catalina].Stan
>>>>>>> dardHost[localhost].StandardContext[/dhis]]
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Muhammad Abdul Hannan Khan
>>>>>>> DHIS2 Country coordinator & Secretary
>>>>>>> HISP Bangladesh
>>>>>>>
>>>>>>> T +880-2- 8816459 <+880%202-8816459>, 8816412 ext 118
>>>>>>> F +88 02 8813 875
>>>>>>> M+88 01819 239 241
>>>>>>> M+88 01534 312 066
>>>>>>> E hannank@xxxxxxxxx
>>>>>>> S hannan.khan.dhaka
>>>>>>> B hannan-tech.blogspot.com
>>>>>>> L https://bd.linkedin.com/in/hannankhan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Muhammad Abdul Hannan Khan
>>>>> DHIS2 Country coordinator & Secretary
>>>>> HISP Bangladesh
>>>>>
>>>>> T +880-2- 8816459 <+880%202-8816459>, 8816412 ext 118
>>>>> F +88 02 8813 875
>>>>> M+88 01819 239 241
>>>>> M+88 01534 312 066
>>>>> E hannank@xxxxxxxxx
>>>>> S hannan.khan.dhaka
>>>>> B hannan-tech.blogspot.com
>>>>> L https://bd.linkedin.com/in/hannankhan
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> *******************************************
>>>
>>> Calle Hedberg
>>>
>>> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>>>
>>> Tel/fax (home): +27-21-685-6472 <+27%2021%20685%206472>
>>>
>>> Cell: +27-82-853-5352 <+27%2082%20853%205352>
>>>
>>> Iridium SatPhone: +8816-315-19119 <+881%206%20315%2019119>
>>>
>>> Email: calle.hedberg@xxxxxxxxx
>>>
>>> Skype: calle_hedberg
>>>
>>> *******************************************
>>>
>>>
>>
>>
>> --
>> Muhammad Abdul Hannan Khan
>> DHIS2 Country coordinator & Secretary
>> HISP Bangladesh
>>
>> T +880-2- 8816459 <+880%202-8816459>, 8816412 ext 118
>> F +88 02 8813 875
>> M+88 01819 239 241
>> M+88 01534 312 066
>> E hannank@xxxxxxxxx
>> S hannan.khan.dhaka
>> B hannan-tech.blogspot.com
>> L https://bd.linkedin.com/in/hannankhan
>>
>>
>>
>
>
> --
>
> *******************************************
>
> Calle Hedberg
>
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>
> Tel/fax (home): +27-21-685-6472 <+27%2021%20685%206472>
>
> Cell: +27-82-853-5352 <+27%2082%20853%205352>
>
> Iridium SatPhone: +8816-315-19119 <+881%206%20315%2019119>
>
> Email: calle.hedberg@xxxxxxxxx
>
> Skype: calle_hedberg
>
> *******************************************
>
>

References