- 2014.05.02, 17:59
- I was fighting a really nasty persistent issue that Tomcat would fail to start if launched from Ant script like so (part of complicated ant script that fills out placeholders conditionally and so on, executed by Jenkins):
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true" clonevm="true">
<jvmarg value="-XX:+UseParallelOldGC"/>
<jvmarg value="-verbose:gc"/>
<jvmarg value="-XX:+PrintGCTimeStamps"/>
<jvmarg value="-XX:+PrintGCDetails"/>
<jvmarg value="-Xloggc:${tomcat.base}/logs/gcLog_${jvmRoute}.log"/>
...
<jvmarg value="-Djava.util.logging.config.file=${tomcat.base}/conf/logging.properties"/>
<jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"/>
<jvmarg value="-Dcom.sun.management.jmxremote=true"/>
<jvmarg value="-Dcom.sun.management.jmxremote.port=${port.jmx}"/>
<jvmarg value="-Dcom.sun.management.jmxremote.authenticate=false"/>
<jvmarg value="-Dcom.sun.management.jmxremote.ssl=false"/>
<jvmarg value="${solrProperty}"/>
<jvmarg line="${JAVA_OPTS}"/>
<jvmarg line="${jacocoArgLine}"/>
<env key="APP_CONFIG_ROOT" path="${APP_CONFIG_ROOT}"/>
</java>
The symptom is that it fails with following error:
Could not load Logmanager "org.apache.juli.ClassLoaderLogManager"
java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[...]
at java.util.logging.LogManager.(LogManager.java:173)
at java.util.logging.Logger.demandLogger(Logger.java:336)
at java.util.logging.Logger.getLogger(Logger.java:390)
at com.sun.jmx.remote.util.ClassLogger.(ClassLogger.java:55)
at sun.management.jmxremote.ConnectorBootstrap.(ConnectorBootstrap.java:823)
at sun.management.Agent.startAgent(Agent.java:260)
at sun.management.Agent.startAgent(Agent.java:456)
Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[...]
at sun.management.Agent.startAgent(Agent.java:260)
at sun.management.Agent.startAgent(Agent.java:456)
Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[...]
at sun.management.Agent.startAgent(Agent.java:456)
Can't load log handler "2localhost.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[...]
at sun.management.Agent.startAgent(Agent.java:456)
Can't load log handler "3manager.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 3manager.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 3manager.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[...]
at sun.management.Agent.startAgent(Agent.java:456)
Can't load log handler "4host-manager.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[...]
at sun.management.Agent.startAgent(Agent.java:456)
Error: Could not find or load main class
It turns out, the error is really simple.
If placeholders for <jvmarg value="${solrProperty}"/>, <jvmarg line="${JAVA_OPTS}"/>, <jvmarg line="${jacocoArgLine}"/> are somehow empty, then Tomcat will crash and burn.
Furthermore, they can't be empty strings. And they can't be standalone strings. You can put some nonsense like "-Dpunk=nown" in place of those, and Tomcat starts happily up.
Make sure all placeholders are filled out.
upd: The empty arg of <jvmarg value="${solrProperty}"/>
is the real culprit. It should be jvmarg line=... .
-
0 rakstair doma