2
votes

I am trying to use the maven tomcat8 plugin which I downloaded from:

https://mvnrepository.com/artifact/org.apache.tomcat.maven/tomcat8-maven-plugin

When I run with mvn tomcat8:run, I get the following error:

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/launchbi-admin]]
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/launchbi-admin]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        ... 6 more
Caused by: java.lang.RuntimeException: C:\Program%20Files\Java\jdk1.8.0_151\jre\lib\rt.jar (The system cannot find the path specified)
        at org.apache.tomcat.maven.plugin.tomcat8.run.RunMojo$2.urlToWebResource(RunMojo.java:499)
        at org.apache.tomcat.maven.plugin.tomcat8.run.RunMojo$2.getClassLoaderResource(RunMojo.java:383)
        at org.apache.catalina.loader.WebappClassLoaderBase.findResourceInternal(WebappClassLoaderBase.java:2529)
        at org.apache.catalina.loader.WebappClassLoaderBase.findResource(WebappClassLoaderBase.java:929)
        at org.apache.catalina.loader.WebappClassLoaderBase.getResourceAsStream(WebappClassLoaderBase.java:1096)
        at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2148)
        at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2138)
        at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2043)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1995)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1944)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1919)
        at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1880)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1149)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5120)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 6 more
Caused by: java.io.FileNotFoundException: C:\Program%20Files\Java\jdk1.8.0_151\jre\lib\rt.jar (The system cannot find the path specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:225)
        at java.util.zip.ZipFile.<init>(ZipFile.java:155)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:103)
        at org.apache.tomcat.maven.plugin.tomcat8.run.RunMojo$2.urlToWebResource(RunMojo.java:479)

However, the rt.jar does exists and my JAVA_HOME environment is set up correctly:

mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: C:\Users\Jonathan\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_151\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

2
I think the presence of the Tomcat maven plugin at the end of a Tomcat stack trace very odd. Please show your pom.xml file.Steve C
pom.xml please...Pratik Ambani

2 Answers

0
votes

Problem is URL encoded space character in path C:\Program%20Files\ ...

It is not - afaik - valid windows path.

If you do not set it explicitly yourself it might be a bug in plugin.

Update: it seems to be a bug:

Maven goal of tomcat8:run fails if Java runtime is installed in path containing spaces

0
votes

the highest version that tomcat maven plugin supported is tomcat 7, you can try spring boot which has several embedded containers