Catalina - Life cycle exception
This post is about maven downloading icu4j.jar as transitive reference to Jaxen and Tomcat Catalina not correctly starting after the reference has been added.
Last project: Tomcat and Java Web application. Suddenly after just after adding some dependencies using Maven, I was not able to start the server. The exception did not give me much details:
Grave: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Bank]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
Caused by: org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.(ConstantPool.java:60)
oct. 07, 2011 2:26:19 PM org.apache.catalina.startup.HostConfig deployDirectory
Grave: Erreur lors du déploiement du répertoire Bank de l'application web
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Bank]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:816)
So after checking the state of web.xml (no changes there) I started to take a look at the dependencies which I have added. Well actually I took a look at the JARs which were being downloaded automatically by Maven. I found out that when I added a dependency to Jaxen library, than several JARs war downloaded.
I started deleting one by one and redeploying, just to find out, that it was ICU4J.JAR which was causing the problem. Well I was sure that I did not need it, so I solved the problem by declaring Maven exclusion.
<dependency>
<groupid>jaxen</groupId>
<artifactid>jaxen</artifactId>
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupid>com.ibm.icu</groupId>
<artifactid>icu4j</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
Curiously enough I needed Jaxen in order to be able to use the Azure4Java tools and access to Azure table storage. Still I do not understand the real cause of this problem, so if anyone finds similar issue, I hope this helps.