I am having issues deploying a web application on an embeded Tomcat 7 with the maven-cargo-plugin. I created a new maven profile in the webapps pom that creates a Tomcat container via the maven-cargo-plugin and then executes a soapui test case via the soapui-maven-plugin.
The webapp connects to some IBM WebSphere MQs therefore I have overwritten some of the containers config files:
- added the MQs as Resources to server.xml for JNDI lookup
- added my custom applicationContext.xml to the classpath by overriding the web.xml
- added the needed Resources in the context.xml that are needed to connect to the MQs
- added the path to the lib directory of a locally installed IBM Websphere MQClient to the containers common.loader so that its libs can be used by the container
Furthermore I copied the needed websphere.mq.*.jar files and j2ee-1.4.jar from a local WebsSphere Server installation to the Tomcat containers lib directory by adding them via cargos <file>
tag.
Now when I startup Maven with this command (where runITs activates the created profile):
clean verify -U -Dhttps.protocols=TLSv1,SSLv3 -DrunITs -X
The deploy fails with:
INFO] [talledLocalContainer] org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cargocpc]]
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader;
[INFO] [talledLocalContainer] at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:90)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1577)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1281)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5412)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer] ... 10 more
I already tried to search for possible solutions and f. e. tried the solution provided here: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
but I could rule out the possible causes because:
- my container is Tomcat 7 and therefore supports Servlet API 2.5
- the web.xml complies Servlet API 2.5
- There are no j2ee.jar or servlet-api.jar files in
WEB-INF/lib
orJRE/lib
After making sure my setup complies these three points I still get the error mentioned above.
Does anyone know what else could cause this?