Bug 39699 - simple deploy failed in cluster (distributable flag)
Summary: simple deploy failed in cluster (distributable flag)
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.17
Hardware: Other Linux
: P2 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-01 16:28 UTC by Christophe Yayon
Modified: 2006-06-09 02:06 UTC (History)
1 user (show)



Attachments
testcase describing cluster related reload of distributable webapps which contain log4j (423.63 KB, application/octet-stream)
2006-06-05 20:58 UTC, Haroon Rafique
Details
Patched version of 5.5.17 catalina-cluster.jar (196.25 KB, application/octet-stream)
2006-06-08 16:54 UTC, Filip Hanik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Yayon 2006-06-01 16:28:04 UTC
Hi,

i encounter a strange problem with my tomcat cluster and webapps deployment.

server.xml
--------------------------------
<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>


  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Catalina">


    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector address="polen-integ" port="8080" maxHttpHeaderSize="8192"
               maxThreads="300" minSpareThreads="25" maxSpareThreads="100"
               enableLookups="false" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
               address="polen-integ.sofinco.fr"
               minProcessors="20" maxProcessors="0" maxThreads="350"
minSpareThreads="50" maxSpareThreads="100"
               enableLookups="false" redirectPort="8080" protocol="AJP/1.3"
disableUploadTimeout="true" />

     <Engine name="Catalina" defaultHost="localhost" jvmRoute="uxdev103" >

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>

      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false" >

 <!-- Cluster Definition -->

        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                doClusterLog="true" clusterLogName="clusterlog"
                expireSessionsOnShutdown="false"
                useDirtyFlag="true"
                notifyListenersOnReplication="true">

        <Membership className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastBindAddress="127.0.0.1"
                mcastClusterDomain="polen-integ"
                mcastPort="45564"
                mcastFrequency="1000"
                mcastDropTime="30000"/>

        <Receiver className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="polen-integ"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>

        <Sender className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="fastasyncqueue"
                doTransmitterProcessingStats="true"
                doProcessingStats="false"
                doWaitAckStats="false"
                waitForAck="false"
                keepAliveMaxRequestCount="-1"/>

        <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
               
filter=".*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"
/>

        <Valve className="org.apache.catalina.cluster.session.JvmRouteBinderValve"
                enabled="true" />

        <ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener" />

        <ClusterListener
className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener" />

        <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                tempDir="/home/tomcat/polen-integ/tmp/war-temp/"
                deployDir="${catalina.base}/webapps"
                watchDir="/home/tomcat/polen-integ/tmp/war-listen/"
                watchEnabled="true"/>

        </Cluster>

      </Host>
    </Engine>

  </Service>

</Server>
------------------------



when i am trying to deploy a 'dsitributable' (and only when this flag is
enabled) i get the following errors :

---------------------------
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.startup.HostConfig - Deploying web application archive po
len.war
 INFO ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.loader.WebappClassLoader - Illegal access: this web appli
cation instance has been stopped already.  Could not load java.io.PrintStream. 
The eventual following stack trace is caused by an error t
hrown for debugging purposes as well as to attempt to terminate the thread which
caused the illegal access, and has no functional impact.
 java.lang.IllegalStateException
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at org.apache.log4j.helpers.LogLog.error(LogLog.java:142)
        at
org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:447)
        at
org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
        at
org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:234)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:976)
        at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.loader.WebappClassLoader - Illegal access: this web applic
ation instance has been stopped already.  Could not load java.io.PrintStream. 
The eventual following stack trace is caused by an error th
rown for debugging purposes as well as to attempt to terminate the thread which
caused the illegal access, and has no functional impact.
 Java.lang.IllegalStateException
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at org.apache.log4j.helpers.LogLog.error(LogLog.java:142)
        at
org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:447)
        at
org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
        at
org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:234)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:976)
 at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.loader.WebappClassLoader - Illegal access: this web applic
ation instance has been stopped already.  Could not load
org.apache.log4j.spi.VectorWriter.  The eventual following stack trace is caused
by an error thrown for debugging purposes as well as to attempt to terminate the
thread which caused the illegal access, and has no functi
onal impact.
 java.lang.IllegalStateException
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:990)
        at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
 at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.loader.WebappClassLoader - Illegal access: this web applic
ation instance has been stopped already.  Could not load
org.apache.log4j.spi.VectorWriter.  The eventual following stack trace is caused
by an error thrown for debugging purposes as well as to attempt to terminate the
thread which caused the illegal access, and has no functi
onal impact.
 java.lang.IllegalStateException
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:990)
        at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
ERROR ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.commons.modeler.Registry - Null component Catalina:type=JspMonitor
,name=jsp,WebModule=//localhost/polen,J2EEApplication=none,J2EEServer=none
 ERROR ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.startup.HostConfig - Error deploying web application arc
hive polen.war
 java.lang.NoClassDefFoundError: org/apache/log4j/spi/VectorWriter
        at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:990)
        at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
ERROR ContainerBackgroundProcessor[StandardEngine[Catalina]]
org.apache.catalina.startup.HostConfig - Error deploying web application arch
ive polen.war
 java.lang.NoClassDefFoundError: org/apache/log4j/spi/VectorWriter
        at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
        at
org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:990)
        at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4125)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1190)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
        at java.lang.Thread.run(Unknown Source)
---------------

i have tried to deployed via web manager application or simple copy of my war in
webapps directory... No luck, if i put '<distributable/> flag in application
web.xml config file, i encounter this error ; i need to restart manually tomcat
instance... After this restart the application is correctly deployed without any
error...
Of course if i disable cluster in server.xml, no problem...
Comment 1 Haroon Rafique 2006-06-01 19:30:03 UTC
same here for me with 5.5.17 on Linux. Same setup on the webapp side used to
work find in 5.5.12.
Comment 2 Christophe Yayon 2006-06-02 05:48:31 UTC
(In reply to comment #1)
> same here for me with 5.5.17 on Linux. Same setup on the webapp side used to
> work find in 5.5.12.

did you tried with 5.5.16 ?
Comment 3 Peter Rossbach 2006-06-02 06:12:28 UTC
It seems that you have a log4j classloader issuse.

I hope you only have a log4j jar and commons-logging inside you app and not at common/lib.

Test it with 5.5.17 again.
Comment 4 Christophe Yayon 2006-06-02 08:20:41 UTC
(In reply to comment #3)
> It seems that you have a log4j classloader issuse.
> 
> I hope you only have a log4j jar and commons-logging inside you app and not at
common/lib.
> 
> Test it with 5.5.17 again.

same isusue after removing commons-logging and log4j (renamed log4j.jar ->
log4j.jar.not and the same for commons-logging.jar) in common/lib (i use log4j
to log tomcat message, not only in webapps...

any idea ?
Comment 5 Haroon Rafique 2006-06-02 11:24:44 UTC
(In reply to comment #2)

> 
> did you tried with 5.5.16 ?


no, I haven't.
Comment 6 Haroon Rafique 2006-06-02 11:26:59 UTC
(In reply to comment #3)
> It seems that you have a log4j classloader issuse.
> 
> I hope you only have a log4j jar and commons-logging inside you app and not at
common/lib.
> 
> Test it with 5.5.17 again.

Just as comment 4, I as well took out log4j and commons-logging from  common/lib
and got the same behavior as before. As Christophe mentioned in comment 0, the
redeploy works fine if the <Cluster> element is commented out.
Comment 7 Haroon Rafique 2006-06-02 11:27:59 UTC
(In reply to comment #4)

> 
> i use log4j to log tomcat message, not only in webapps...
> 

I use log4j for the same purpose.
Comment 8 Christophe Yayon 2006-06-02 12:07:33 UTC
(In reply to comment #7)
> (In reply to comment #4)
> 
> > 
> > i use log4j to log tomcat message, not only in webapps...
> > 
> 
> I use log4j for the same purpose.
> 

got the same in 5.5.16...
do you know where can i found 5.5.12 ?

thanks in advance.
Comment 9 Haroon Rafique 2006-06-02 12:12:39 UTC
(In reply to comment #8)
> 
> got the same in 5.5.16...
> do you know where can i found 5.5.12 ?
> 
> thanks in advance.

Try:
http://archive.apache.org/dist/jakarta/tomcat-5/v5.5.12/bin/
Comment 10 Christophe Yayon 2006-06-02 13:24:34 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > 
> > got the same in 5.5.16...
> > do you know where can i found 5.5.12 ?
> > 
> > thanks in advance.
> 
> Try:
> http://archive.apache.org/dist/jakarta/tomcat-5/v5.5.12/bin/
thanks.

Ok, i just tried with 5.5.12 it's ok, no issue...
i have also tried with others versions :

5.5.12 : ok
5.5.13 : BUG
5.5.16 : BUG
5.5.17 : BUG 

it appears that there was a change from 5.5.13 ...
Comment 11 Haroon Rafique 2006-06-02 13:48:37 UTC
(In reply to comment #10)
> 
> Ok, i just tried with 5.5.12 it's ok, no issue...
> i have also tried with others versions :
> 
> 5.5.12 : ok
> 5.5.13 : BUG
> 5.5.16 : BUG
> 5.5.17 : BUG 
> 
> it appears that there was a change from 5.5.13 ...
> 

I have 5.5.12 in production with no problems. And yes, 5.5.13 causes the bug to
appear for me as well. So, something changed from 5.5.12 -> 5.5.13. Time to look
at the changelog for 5.5.13.
Comment 12 Haroon Rafique 2006-06-02 14:15:18 UTC
(In reply to comment #11)
> 
> I have 5.5.12 in production with no problems. And yes, 5.5.13 causes the bug to
> appear for me as well. So, something changed from 5.5.12 -> 5.5.13. Time to look
> at the changelog for 5.5.13.

I didn't see anything in the 5.5.13 changelog (with my untrained eye). However,
this discussion seems to be similar.

http://www.nabble.com/RE%3A-Tomcat-5.5.15-Context-Reloading-issue-t1123634.html#a3010048

Rémy?

In that thread Rémy says:

    I added some code to null out certain instances, and your shared log4j
    setup doesn't like it (at least it's a likely possibility). Try to use
    a JNDI based log4j setup (or similar, using one logging namespace for
    all webapps is not clean), or don't share it. 

Would it be possible to see where is the code which nulls out certain instances??

The precursor the above thread is at:
http://www.nabble.com/Tomcat-5.5.15-Context-Reloading-issue-t1076386.html#a2955863

Be aware that in comment 4 and comment 6, both Christophe and I have reported
that even with nothing in common/lib (no log4j.jar, no commons-logging.jar), we
still get the bug. The only log4j.jar and commons-logging.jar is the one present
in WEB-INF/lib of the webapp. So, more than likely the "shared log4j" setup is
not the culprit.
Comment 13 Christophe Yayon 2006-06-02 14:25:18 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > 
> > I have 5.5.12 in production with no problems. And yes, 5.5.13 causes the bug to
> > appear for me as well. So, something changed from 5.5.12 -> 5.5.13. Time to look
> > at the changelog for 5.5.13.
> 
> I didn't see anything in the 5.5.13 changelog (with my untrained eye). However,
> this discussion seems to be similar.
> 
>
http://www.nabble.com/RE%3A-Tomcat-5.5.15-Context-Reloading-issue-t1123634.html#a3010048
> 
> Rémy?
> 
> In that thread Rémy says:
> 
>     I added some code to null out certain instances, and your shared log4j
>     setup doesn't like it (at least it's a likely possibility). Try to use
>     a JNDI based log4j setup (or similar, using one logging namespace for
>     all webapps is not clean), or don't share it. 
> 
> Would it be possible to see where is the code which nulls out certain instances??
> 
> The precursor the above thread is at:
> http://www.nabble.com/Tomcat-5.5.15-Context-Reloading-issue-t1076386.html#a2955863
> 
> Be aware that in comment 4 and comment 6, both Christophe and I have reported
> that even with nothing in common/lib (no log4j.jar, no commons-logging.jar), we
> still get the bug. The only log4j.jar and commons-logging.jar is the one present
> in WEB-INF/lib of the webapp. So, more than likely the "shared log4j" setup is
> not the culprit.



in 5.5.12, deploy is ok, but i get this recurrent error in log :
----------------------
 ERROR org.apache.catalina.cluster.tcp.TcpReplicationThread[3]
org.apache.catalina.cluster.tcp.TcpReplicationThread -
 TCP Worker thread in cluster caught 'java.io.IOException: Connection reset by
peer' closing channel
 java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(Unknown Source)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
        at sun.nio.ch.IOUtil.read(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
        at
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:125)
        at
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:69)
ERROR org.apache.catalina.cluster.tcp.TcpReplicationThread[3]
org.apache.catalina.cluster.tcp.TcpReplicationThread -
TCP Worker thread in cluster caught 'java.io.IOException: Connection reset by
peer' closing channel
 java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(Unknown Source)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
        at sun.nio.ch.IOUtil.read(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
        at
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:125)
        at
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:69)
--------------------
Comment 14 Haroon Rafique 2006-06-02 14:42:40 UTC
(In reply to comment #13)
> 
> 
> in 5.5.12, deploy is ok, but i get this recurrent error in log :
>

That looks like bug 38788, so its a separate issue.
Comment 15 Christophe Yayon 2006-06-02 18:24:31 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > 
> > 
> > in 5.5.12, deploy is ok, but i get this recurrent error in log :
> >
> 
> That looks like bug 38788, so its a separate issue.

ok...
i didn't know...
Comment 16 Filip Hanik 2006-06-02 21:55:03 UTC
please attach a test case, that way we can get the facts and fix it more promptly.
Comment 17 Christophe Yayon 2006-06-03 07:39:18 UTC
(In reply to comment #16)
> please attach a test case, that way we can get the facts and fix it more promptly.

sorry, but what do you mean with a 'test case'?

You can reproduce the problem with the server.xml in my first post (a simple
cluster configuration is sufficient (<SimpleTcpCluster line only is sufficient)
and try to deploy with html manager or copy a war to your webapps (with
autodeploy enabled of course). 

Comment 18 Filip Hanik 2006-06-03 15:42:03 UTC
test case, meaning maybe a zip containing your config files, any modifications
that you have made two tomcat, ie, added in log4j etc.

ie, can you get us detailed instructions on how to exactly reproduce your
problem. just saying that deploy an app and it breaks, it simply not sufficient,
as our apps are deploying.
Comment 19 Haroon Rafique 2006-06-05 20:57:19 UTC
(In reply to comment #18)
> test case, meaning maybe a zip containing your config files, any modifications
> that you have made two tomcat, ie, added in log4j etc.
> 
> ie, can you get us detailed instructions on how to exactly reproduce your
> problem. just saying that deploy an app and it breaks, it simply not sufficient,
> as our apps are deploying.

I have made some progress with a "simple" test case. Here are the steps:

1) download vanilla tomcat .tar.gz (5.5.17)
2) tar xzvf /home/haroon/src/dist/apache-tomcat-5.5.17.tar.gz
3) cd apache-tomcat-5.5.17/conf/
4) edit server.xml to uncomment the <Cluster> config (leave everything else as is)
5) edit tomcat-users.xml so that you have a username/password with role "manager"
6) cd ../bin
7) ./startup.sh
8) After tomcat starts up, deploy testcase by copying
servlets-examples-cluster-node1.war to ../webapps (I will attach .war file in
next comment)
9) context deploys fine
10) go to http://localhost:8080/manager/html/list in your browser
11) Watch your catalina.out as you click on Reload for
servlets-examples-cluster-node1 and get the error.

Questions?
Comment 20 Haroon Rafique 2006-06-05 20:58:49 UTC
Created attachment 18406 [details]
testcase describing cluster related reload of distributable webapps which contain log4j
Comment 21 Haroon Rafique 2006-06-05 21:03:10 UTC
(In reply to comment #20)

> testcase describing cluster related reload of distributable webapps which
> contain log4j
> 

To give you some information about how I created this "sample testcase" app.

* I obtained the file from
http://opensource.atlassian.com/confluence/oss/pages/viewpageattachments.action?pageId=2578
which is a page for listing the attachments for the wiki article at:
http://opensource.atlassian.com/confluence/oss/display/GERONIMO/Geronimo+Clustering+Example

* After that I added a simple log4j.properties in WEB-INF/classes

---begin-----
# This is the configuration for logging displayed in the Application Server
log4j.rootLogger=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %C{1}.%M(%L)
|%m%n
-----cut-----

* copied commons-logging.jar (I think 1.0.4) and log4j-1.2.13.jar in WEB-INF/lib

That is the exact jar that you see in the attachment in the previous comment.
Comment 22 Haroon Rafique 2006-06-05 21:04:06 UTC
(In reply to comment #21)
> 
> That is the exact jar that you see in the attachment in the previous comment.

oops... meant to say war file (instead of jar)
Comment 23 Remy Maucherat 2006-06-08 12:35:44 UTC
The issue is fairly obvious: the class uses a static logger (initialized with a
random context class loader set) which is never reset, while it should be
logging to the log field inherited from ManagerBase.

-> the solution is to remove:
    public static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory
            .getLog(DeltaManager.class);
Comment 24 Haroon Rafique 2006-06-08 14:14:27 UTC
(In reply to comment #23)
> The issue is fairly obvious: the class uses a static logger (initialized with a
> random context class loader set) which is never reset, while it should be
> logging to the log field inherited from ManagerBase.
> 
> -> the solution is to remove:
>     public static org.apache.commons.logging.Log log =
> org.apache.commons.logging.LogFactory
>             .getLog(DeltaManager.class);
> 

I tried that. The problem did not go away. Same as before:

log4j:ERROR Error occured while converting date.
java.lang.NullPointerException
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:488)
    at java.lang.StringBuffer.append(StringBuffer.java:302)
    at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:132)
    at java.text.DateFormat.format(DateFormat.java:314)
    at
org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
    at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
    at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
    at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
    at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
    at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
    at org.apache.log4j.Category.callAppenders(Category.java:203)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.log(Category.java:853)
    at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
    at org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:975)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4137)
    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
    at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:906)
    at
org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:473)
    at
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at
org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:346)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
    at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
    at java.lang.Thread.run(Thread.java:595)
Jun 8, 2006 9:55:08 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. 
Could not load org.apache.log4j.spi.VectorWriter.  The eventual following stack
trace is caused by an error thrown for debugging purposes as well as to attempt
to terminate the thread which caused the illegal access, and has no functional
impact.
java.lang.IllegalStateException
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.log(Category.java:853)
    at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
    at org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:989)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4137)
    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
    at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:906)
    at
org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:473)
    at
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at
org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:346)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
    at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
    at java.lang.Thread.run(Thread.java:595)
Jun 8, 2006 9:55:08 AM org.apache.commons.modeler.Registry registerComponent
SEVERE: Null component
Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/servlets-examples-cluster-node1,J2EEApplication=none,J2EEServer=none
Comment 25 Haroon Rafique 2006-06-08 14:16:38 UTC
(In reply to comment #24)
> 
> I tried that. The problem did not go away. Same as before:
> 

Please also remember that the first error talks about Error occured while
converting date and my log4j.appender.stdout.layout.ConversionPattern does have
%d{ISO8601}. Is that date not available or null?
Comment 26 Remy Maucherat 2006-06-08 14:38:35 UTC
Ok, I just told that to help, and beyond that I don't care at all. My workaround
may not work for a simple reload, though.
Comment 27 Filip Hanik 2006-06-08 14:59:05 UTC
I'll look into it today
Comment 28 Remy Maucherat 2006-06-08 15:00:41 UTC
Ok, so my most likely better but still very similar workaround is to instantiate
the manager earlier.
Comment 29 Filip Hanik 2006-06-08 16:54:54 UTC
Created attachment 18431 [details]
Patched version of 5.5.17 catalina-cluster.jar
Comment 30 Filip Hanik 2006-06-08 16:55:15 UTC
Thanks for the hint Remy, entirely the clusters fault as it was not setting the
context class loader when loading the manager instances.

I have attached a patched catalina-cluster.jar, can you please verify the fix.
It will also be included in the next release of Tomcat

Please let us know if this works for you.
Comment 31 Haroon Rafique 2006-06-08 17:01:44 UTC
(In reply to comment #30)
> 
> Please let us know if this works for you.

Yes, it works for me with my sample testcase. Kudos to you guys for the quick
fix. I will try it with my regular webapp and hopefully it will not have any
problems.

Christophe, is your problem fixed?
Comment 32 Christophe Yayon 2006-06-08 17:40:00 UTC
i will test tomorrow...

Comment 33 Haroon Rafique 2006-06-08 21:25:12 UTC
(In reply to comment #31)
> 
> Yes, it works for me with my sample testcase. Kudos to you guys for the quick
> fix. I will try it with my regular webapp and hopefully it will not have any
> problems.
> 

Pleased to report that my production webapp encountered no problems either with
the new jar.
Comment 34 Remy Maucherat 2006-06-09 06:52:34 UTC
(In reply to comment #30)
> Thanks for the hint Remy, entirely the clusters fault as it was not setting the
> context class loader when loading the manager instances.
> 
> I have attached a patched catalina-cluster.jar, can you please verify the fix.
> It will also be included in the next release of Tomcat
> 
> Please let us know if this works for you.

If it works, I think backporting the change I did in the dev branch of Tomcat
would be a good idea. I don't think it's really the job of the manager
implementation to deal with context class loaders.
Comment 35 Christophe Yayon 2006-06-09 09:06:40 UTC
No more problem with the new jar !

Thank you very much for your very quick fix...