tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <>
Subject RE: How to debug Error: listenerStart?
Date Sun, 05 Apr 2009 14:19:37 GMT

log4j errors when porting a 5.5 webapp to 6.x: output/build/webapp/docs/logging.html

   1.  Create a file called with the following content and save it into $CATALINA_HOME/lib.
                  log4j.rootLogger=debug, R 
                  log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 
        , R
--done no problems--
   2. Download Log4J (v1.2 or later) and place the log4j jar in $CATALINA_HOME/lib.
--done no problems--   

   3. Build the commons-logging additional component using the extras.xml Ant build script
which is part of the Tomcat source bundle.

--start extras.xml from Tomcat source bundle (which BTW has no references to log4j) --
<?xml version="1.0"?>
<project name="Tomcat 6.0" default="extras" basedir=".">

  <!-- ===================== Initialize Property Values =================== -->

  <!-- See "" in the top level directory for all     -->
  <!-- property values you must customize for successful building!!!        -->
  <property file="${user.home}/"/>
  <property file=""/>

  <property file=""/>

  <!-- Project Properties -->
  <property name="name"                  value="Apache Tomcat" />
  <property name="year"                  value="2007" />
  <property name="version.major"         value="6" />
  <property name="version.minor"         value="0" />
  <property name=""         value="0" />
  <property name="version.patch"         value="0" />
  <property name="version"               value="6.0.0-dev" />
  <property name="version.number"        value="${version.major}.${version.minor}.${}.${version.patch}"

  <property name="project"               value="apache-tomcat" />
  <property name=""            value="${project}-${version}" />
  <property name=""        value="${project}-${version}-src" />

  <!-- Build Defaults -->
  <property name=""      value="${basedir}/output/build"/>
  <property name="tomcat.classes"    value="${basedir}/output/classes"/>
  <property name="tomcat.dist"       value="${basedir}/output/dist"/>
  <property name="tomcat.extras"     value="${basedir}/output/extras"/>
  <property name="tomcat.deployer"   value="${basedir}/output/deployer"/>
  <property name="tomcat.release"    value="${basedir}/output/release"/>
  <property name="test.failonerror"  value="true"/>
  <property name="test.runner"       value="junit.textui.TestRunner"/>

  <!-- Can't be lower - jsp uses templates -->
  <property name="compile.source" value="1.5"/>

  <!-- JAR artifacts -->
  <property name="bootstrap.jar" value="${}/bin/bootstrap.jar"/>

  <property name="annotations-api.jar" value="${}/lib/annotations-api.jar"/>
  <property name="servlet-api.jar" value="${}/lib/servlet-api.jar"/>
  <property name="jsp-api.jar" value="${}/lib/jsp-api.jar"/>
  <property name="el-api.jar" value="${}/lib/el-api.jar"/>
  <property name="catalina.jar" value="${}/lib/catalina.jar"/>
  <property name="catalina-ant.jar" value="${}/lib/catalina-ant.jar"/>
  <property name="catalina-ant-jmx.jar" value="${}/lib/catalina-ant-jmx.jar"/>
  <property name="tomcat-coyote.jar" value="${}/lib/tomcat-coyote.jar"/>

  <property name="jasper.jar" value="${}/lib/jasper.jar"/>
  <property name="jasper-el.jar" value="${}/lib/jasper-el.jar"/>

  <property name="tomcat-dbcp.home" value="${base.path}/tomcat6-deps/dbcp" />
  <property name="jasper-jdt.home" value="${base.path}/tomcat6-deps/jdt" />
  <property name="tomcat-dbcp.jar" value="${tomcat-dbcp.home}/tomcat-dbcp.jar"/>
  <property name="jasper-jdt.jar" value="${jasper-jdt.home}/jasper-jdt.jar"/>

  <property name="tomcat-juli.jar" value="${tomcat.extras}/tomcat-juli.jar"/>
  <property name="tomcat-juli-adapters.jar" value="${tomcat.extras}/tomcat-juli-adapters.jar"/>
  <property name="catalina-ws.jar" value="${tomcat.extras}/catalina-ws.jar"/>
  <!-- Classpath -->
  <path id="tomcat.classpath">
    <pathelement location="${tomcat.classes}"/>

  <target name="prepare">
    <mkdir dir="${tomcat.extras}"/>

  <target name="clean">
      <delete dir="${tomcat.extras}"/>

  <target name="commons-logging">
    <antcall target="downloadfile">
      <param name="sourcefile" value="${commons-logging-src.loc}"/>
      <param name="destfile" value="${tomcat.extras}/logging/commons-logging-src.tar.gz"/>
      <param name="destdir" value="${tomcat.extras}/logging/"/>
    <gunzip src="${tomcat.extras}/logging/commons-logging-src.tar.gz" 
    <untar src="${tomcat.extras}/logging/commons-logging-src.tar" 
    <replace dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/commons"
      <replacefilter token="org.apache.commons"
            value="org.apache.juli" />
    <mkdir dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/juli"
    <move todir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/juli">
      <fileset dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/commons"

    <replace dir="${tomcat.extras}/logging/commons-logging-1.1-src" >
      <replacefilter token="org.apache.commons"
            value="org.apache.juli" />
        <replacefilter token="org/apache/commons/"
              value="org/apache/juli/" />
    <copy tofile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml" 
        file="${tomcat.extras}/logging/commons-logging-1.1-src/build.xml" />

      <ant antfile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml"
           target="getlibs" />
    <copy todir="${tomcat.extras}/logging/commons-logging-1.1-src">
      <fileset dir="${tomcat.extras}/logging/commons-logging-1.1-src/lib" />
      <ant antfile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml"
           target="compile" />
    <jar jarfile="${tomcat-juli.jar}">
      <fileset dir="${tomcat.extras}/logging/commons-logging-1.1-src/target/classes">
        <include name="org/apache/juli/logging/*.class" /> 
        <include name="org/apache/juli/logging/impl/LogFactoryImpl*.class" /> 
        <include name="org/apache/juli/logging/impl/WeakHashtable*.class" /> 
        <include name="org/apache/juli/logging/impl/SimpleLog*.class" /> 
        <include name="org/apache/juli/logging/impl/NoOpLog*.class" /> 
        <include name="org/apache/juli/logging/impl/Jdk14Logger.class" /> 
        <include name="META-INF/LICENSE.txt" /> 
        <include name="META-INF/NOTICE.txt" /> 
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
      <fileset dir="${tomcat.classes}">
        <include name="org/apache/juli/*" />
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
    <checksum file="${tomcat-juli.jar}"
              forceOverwrite="yes" fileext=".md5" />

    <jar jarfile="${tomcat-juli-adapters.jar}">
      <fileset dir="${tomcat.extras}/logging/commons-logging-1.1-src/target/classes">
        <include name="org/apache/juli/logging/impl/**.class" /> 
        <exclude name="org/apache/juli/logging/impl/WeakHashtable*.class" /> 
        <exclude name="org/apache/juli/logging/impl/LogFactoryImpl.class" /> 
        <include name="META-INF/LICENSE.txt" /> 
        <include name="META-INF/NOTICE.txt" /> 
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
    <checksum file="${tomcat-juli-adapters.jar}"
              forceOverwrite="yes" fileext=".md5" />


  <target name="webservices">
        <mkdir dir="${tomcat.extras}/webservices"/>
        <antcall target="downloadfile">
          <param name="sourcefile" value="${jaxrpc-src.loc}"/>
          <param name="destfile" value="${tomcat.extras}/webservices/jaxrpc.jar"/>
          <param name="destdir" value="${tomcat.extras}/webservices/"/>
        <antcall target="downloadfile">
          <param name="sourcefile" value="${wsdl4j-src.loc}"/>
          <param name="destfile" value="${tomcat.extras}/webservices/wsdl4j.jar"/>
          <param name="destdir" value="${tomcat.extras}/webservices/"/>
        <!-- Classpath -->
        <path id="tomcat.webservices.classpath">
          <pathelement path="${tomcat.classpath}"/>
          <fileset dir="${tomcat.extras}/webservices">
            <include name="jaxrpc.jar"/>
            <include name="wsdl4j.jar"/>
        <!-- Compile internal server components -->
        <javac srcdir="java" destdir="${tomcat.classes}"
          <classpath refid="tomcat.webservices.classpath" />
          <include name="org/apache/naming/factory/webservices/**" />
        <!-- Catalina Main JAR File -->
        <jar jarfile="${catalina-ws.jar}">
          <fileset dir="${tomcat.classes}">
            <include name="org/apache/naming/factory/webservices/**" />
            <!-- Javadoc and i18n exclusions -->
            <exclude name="**/package.html" />
            <exclude name="**/LocalStrings_*" />
        <checksum file="${catalina-ws.jar}"
              forceOverwrite="yes" fileext=".md5" />

  <target name="extras" depends="prepare,commons-logging,webservices">

  <!-- Download and dependency building -->
  <target name="proxyflags">
    <!-- check proxy parameters. -->
    <condition property="useproxy">
      <equals arg1="${proxy.use}" arg2="on" />

  <target name="setproxy" depends="proxyflags" if="useproxy">
    <taskdef name="setproxy"
            classname="" />
    <setproxy proxyhost="${}" proxyport="${proxy.port}"
              proxyuser="${proxy.user}" proxypassword="${proxy.password}" />
    <echo message="Using ${}:${proxy.port} to download ${sourcefile}"/>

  <target name="testexist">
    <echo message="Testing  for ${destfile}"/>
    <available file="${destfile}" property="exist"/>

  <target name="downloadfile" unless="exist" depends="setproxy,testexist">
    <!-- Download extract the file -->
    <mkdir dir="${destdir}" />
    <get src="${sourcefile}" dest="${destfile}" />

--end  extras.xml (which has no log4j.references) --

   4. Replace $CATALINA_HOME/bin/tomcat-juli.jar with output/extras/tomcat-juli.jar.
--where is output/extras/tomcat-juli.jar in it is in bin only?

   5. Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
--where is output/extras/tomcat-juli.jar in it is in bin only?

   6. Start Tomcat
--no effect log4j is not started..

Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality note 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
This message is confidential and may be privileged. If you are not the intended recipient,
we kindly ask you to  please inform the sender. Any unauthorised dissemination or copying
hereof is prohibited. This message serves for information purposes only and shall not have
any legally binding effect. Given that e-mails can easily be subject to manipulation, we can
not accept any liability for the content provided.

> From:
> To:
> Date: Sat, 4 Apr 2009 21:08:55 -0500
> Subject: RE: How to debug Error: listenerStart?
> > From: Dan Armbrust []
> > Subject: Re: How to debug Error: listenerStart?
> > 
> > Perhaps it is behaving different on Tomcat 6.  I didn't try 6, only
> > the latest 5.5, since that's what I'm using in production.
> Sorry, I didn't realize this was only a 5.5 issue.  I did try it again on 5.5.27, and
verified your findings.
> > Also, your stack trace is showing that it was indeed, logged by
> > tomcat's loggers.  Did you try renaming the
> > file that I provided?
> Just tried it again on 6.0.18 with the unhidden, and there was no difference.
 Also, with the original, untouched a.war, there were no messages about log4j initialization
problems.  So under 6.0, it appears that Tomcat is *not* trying to use your log4j.
> > I contend that it should never be printed by log4j, since that is
> > within the webapp which is failing - and tomcat can't know that log4j
> > has been configured.  But yet, on my system, that is exactly what is
> > happening.
> I think I figured out what's going on.  Tomcat 5.5 uses an unmodified LogFactory from
commons-logging, which pokes around for logging mechanisms - and finds your log4j.jar inside
your webapp.  Tomcat 6.0, on the other hand, uses a modified LogFactory, which is hard-coded
to use an enhanced version of java.util.logging, so it never looks for your log4j.  Looks
like Tomcat 6 implements what you're looking for, so you might want to consider moving up.
> > I'm also still looking into a (possibly?) related issue 
> > that I have where log4j in every webapp deployed beyond 
> > the first fails to auto-configure.
> I suspect it is related.  Since commons-logging is loaded by the system classloader,
I'm wondering if it may be hanging onto data from the first it finds (since
there's no global log4j) rather than looking for one for each webapp.  Again, this doesn't
appear to be an issue in 6.0.
>  - Chuck
is thus for use only by the intended recipient. If you received this in error, please contact
the sender and delete the e-mail and its attachments from all computers.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Rediscover HotmailĀ®: Get quick friend updates right in your inbox.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message