Just to give everyone some background on the reported problem.  When
undeploying a webapp in Tomcat, the log4j jar remains "locked" and cannot be
deleted or replaced until Tomcat is shutdown.  Jake Kjome reported this
problem some time back on the user list, and we have been looking at the
issue off and on.

-Mark

-----Original Message-----
From: Mark Womack [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 9:48 AM
To: 'Jacob Kjome'; [EMAIL PROTECTED]
Cc: Ceki Gülcü
Subject: RE: Re[8]: log4j.jar locked by Tomcat even after
remove/undeploy ....


> Mark, you may have seen the app that I sent to Ceki as I
> think he forwarded that
> on to you after you sent this message.  Try that one out.

I will.  Ceki, if you have not sent it to me yet, please do, to my
[EMAIL PROTECTED] address.

> Anyway, as far as not being able to remove xerces.jar, I'm
> not sure.  One thing
> to note is that it isn't actually legal to put xerces.jar
> inside WEB-INF/lib.
> It violates the sun classloading spec that Tomcat enforces.
> Basically, tomcat
> should ignore it and use xerces from a parent classloader.
> Anway, that was as
> tangent....

Hm.  I thought there was something in the new Servlet 2.3 spec that
basically said the container would "insulate" the web applications from its
xml parser technology and allow web apps to use their own (via the
WEB-INF/lib dir).  That way a web app is not stuck with whatever version the
container decided to implement with.  Maybe I am wrong there.
Interestingly, like log4j, I am sure that the xerces jar does create some
static objects.  I don't know if that means anything.

> The thing is, I have apps with lots of jars, although not
> xerces.jar, in
> WEB-INF/lib and when I install, then remove the apps, the
> *only* jar that is
> locked up is log4j-1.2.6.jar.  I've tested trying to delete
> the other jars after
> the remove and I am successful in every case.

I can try a different jar.

> I just tested your app and put catalina-ant.jar in
> WEB-INF/lib.  Nothing
> actually references it during runtime, but when I install the
> webapp and then
> try to delete catalina-ant.jar, it is locked.  Then, I remove
> the webapp and try
> to delete catalina-ant.jar and it does get deleted.  However,
> log4j-1.2.6.jar
> cannot be deleted when I try to until I shut down Tomcat.

Hm.  I didn't look closely, but does Tomcat ship with log4j?  If it ships
with log4j and xerces, again, maybe there is some issue in Tomcat regarding
these jars.  I don't know.  I am not saying that this is not a log4j
problem, I just find it curious that this has not been reported/found
earlier.  If there were a general problem of logj not being released, it
should show up in other web containers like resin or weblogic.  There have
not been any reported problems in that regard, as far as I am aware.

I'll look at it some more this evening though.

-Mark

> All this was performed with the following setup:
>
> The webapp is located at:
> C:\myclasses\webapps\barracuda-webapp
>
> The following was used to install and remove the webapp:
> http://localhost:8080/manager/install?path=/barracuda&war=file
> :///C:/myclasses/webapps/barracuda-webapp
> http://localhost:8080/manager/remove?path=/barracuda&war=file:
> ///C:/myclasses/webapps/barracuda-webapp
>
> If you try out the webapp I sent to Ceki (and he forwarded
> that to you), you
> won't have to mess with any paths in log4j.xml or anything.
> It will all be set
> up for you and the log will appear in build/WEB-INF/logs.
>
> So, I guess I don't agree that this is a Tomcat thing.  It
> seems specific to
> Log4j.  I suppose Tomcat could be getting confused with Log4j
> since they use it
> internally and maybe won't let go of the file.  However, I'd
> like to be able to
> track that down and say that for sure and then tell the
> Tomcat developers to fix
> the issue.  But I want to make sure of what the issue is
> first before I run to
> them telling them to fix it.
>
> later,
>
> Jake
>
> Quoting [EMAIL PROTECTED]:
>
> > I think I have replicated the problem using Tomcat 4.1.12
> with the enclosed
> > webapp.  To replicate my set up, just add the log4j-1.2.6.jar to the
> > WEB-INF/lib and you might want to modify the FileAppender
> file location in
> > the log4j.xml.
> >
> > All I really did, besides create a webapp I could work
> with, was to greatly
> > simplify the log4j.xml and web.xml files to more of a
> minimum.  All log4j
> > creates is a ConsoleAppender and a FileAppender.  A next
> step would be to
> > modify the Log4jInit.java class to simplify it to a bare
> minimum log4j
> > startup.
> >
> > This is the command I am using to install the webapp, after
> copying it to
> > jakarta-tomcat-4.1.12/webapps/:
> >
> >
> http://localhost:8080/manager/install?path=/barracuda&war=file
> :/barracuda-we
> > bapp
> >
> > And this is the command I use to remove it:
> >
> >
> http://localhost:8080/manager/remove?path=/barracuda&war=file:
> /barracuda-web
> > app
> >
> > I exercised log4j by accessing the jsp
> >
> > http://localhost:8080/barracuda/test.jsp
> >
> > You can check the output of the file appender to make sure
> it is working.
> > Mine was working fine.
> >
> > Jake, the problem you are seeing is that the
> log4j-1.2.6.jar cannot be
> > moved
> > or replaced after the webapp has been removed from Tomcat, correct?
> >
> > So, I did a little test.  I also put the xerces.jar in the
> WEB-INF/lib
> > directory, removed the app, shutdown and restarted tomcat,
> installed the
> > app, hit the test.jsp, then removed the webapp.  I can't
> move or copy over
> > the xerces.jar either after the webapp has been removed.
> So, are we sure
> > that this is a log4j problem and not a tomcat problem?  Is
> there some step
> > or something more I am missing?
> >
> > Please include my [EMAIL PROTECTED] address in any replies.
> >
> > -Mark
> >
> > > -----Original Message-----
> > > From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, September 27, 2002 1:45 PM
> > > To: Mark Womack
> > > Subject: Re[8]: log4j.jar locked by Tomcat even after
> remove/undeploy
> > > ....
> > >
> > >
> > > Hello Mark,
> > >
> > > If you click this link:
> > > http://marc.theaimsgroup.com/?l=log4j-user&m=103287412303294&q=p6
> > >
> > > you will be downloading a file named
> Barracuda_log4j_setup.zip which
> > > contains the following:
> > >
> > > log4j.xml (contains all loggers and appenders that I use)
> > > Log4jApplicationWatch.java (a servlet context listener)
> > > Log4jInit.java (my initialization servlet)
> > > web.xml (containing a <servlet> entry to load log4jinit
> at application
> > >          startup)
> > >
> > > If you look at log4j.xml, you will see all the
> configuration I use for
> > > log4j.
> > >
> > > Actually, I'll just attach it.  That'll make things easier...
> > >
> > > Jake
> > >
> > >
> > > Friday, September 27, 2002, 2:46:34 PM, you wrote:
> > >
> > > MW> Jake,
> > >
> > > MW> I have not had a chance to look at it.
> > >
> > > MW> Just a question, what appenders are you using as part of your
> > > configuration?
> > >
> > > MW> -Mark
> > >
> > > >> -----Original Message-----
> > > >> From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
> > > >> Sent: Friday, September 27, 2002 12:37 PM
> > > >> To: Mark Womack
> > > >> Subject: Fwd: Re[6]: log4j.jar locked by Tomcat even after
> > > >> remove/undeploy ....
> > > >>
> > > >>
> > > >> Hi Mark,
> > > >>
> > > >> I haven't heard anything back from you about the Log4jInit
> > > >> servlet and the
> > > >> log4j.jar being locked.  Have you had a chance to test
> at all?  I
> > > >> don't mean to pressure you or anything, but I need to
> find a solution
> > > >> to this pretty soon.
> > > >>
> > > >> thanks,
> > > >>
> > > >> Jake
> > > >>
> > > >>
> > > >> This is a forwarded message
> > > >> From: Jacob Kjome <[EMAIL PROTECTED]>
> > > >> To: "Log4J Users List" <[EMAIL PROTECTED]>
> > > >> Date: Tuesday, September 24, 2002, 4:07:40 PM
> > > >> Subject: log4j.jar locked by Tomcat even after
> remove/undeploy ....
> > > >>
> > > >> ===8<==============Original message text===============
> > > >> Hello Mark,
> > > >>
> > > >> See this message:
> > > >>
> http://marc.theaimsgroup.com/?l=log4j-user&m=103287412303294&w=2
> > > >>
> > > >> At the bottom, there is a link to the zip file I
> posted of all code
> > > >> that has to do with setting up log4j in our app...including
> > > >> log4jinit.java.
> > > >>
> > > >>
> http://marc.theaimsgroup.com/?l=log4j-user&m=103287412303294&q=p6
> > > >>
> > > >> Jake
> > > >>
> > > >> Tuesday, September 24, 2002, 3:52:44 PM, you wrote:
> > > >>
> > > >> MW> Maybe this has already been discussed...but what does
> > > >> your log4j init
> > > >> MW> servlet look like?  Can you post the code?
> > > >>
> > > >> MW> -Mark
> > > >>
> > > >> >> -----Original Message-----
> > > >> >> From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
> > > >> >> Sent: Tuesday, September 24, 2002 1:51 PM
> > > >> >> To: Log4J Users List
> > > >> >> Subject: Re[4]: log4j.jar locked by Tomcat even after
> > > >> >> remove/undeploy....
> > > >> >>
> > > >> >>
> > > >> >> Hello Ceki,
> > > >> >>
> > > >> >> I'm using log4j-1.2.6.  I just tested the app after
> > > >> commenting out the
> > > >> >> <load-on-startup> line for the log4j-init servlet in the
> > > >> >> web.xml.  log4j.jar is *not* locked
> > > >> >> after shutting down the application.  I don't have
> to shut down the
> > > >> >> server to release the resource in this case.
> > > >> >>
> > > >> >> Jake
> > > >> >>
> > > >> >> Tuesday, September 24, 2002, 2:23:56 PM, you wrote:
> > > >> >>
> > > >> >>
> > > >> >> CG> Which version of log4j is this? Tomcat? Can you see what
> > > >> >> happens if log4j
> > > >> >> CG> is not configured at all?
> > > >> >>
> > > >> >> CG> At 14:05 24.09.2002 -0500, you wrote:
> > > >> >> >>Hello Jacob,
> > > >> >> >>
> > > >> >> >>After testing with and without using
> > > >> configureAndWatch(), I am sorry
> > > >> >> >>to say that I get the same behavior.  The lo4j.jar is
> > > >> still locked
> > > >> >> >>until I shut down the whole Tomcat server.  Shutting down
> > > >> >> the current
> > > >> >> >>webapp releases *all* resource except log4j.jar.
> > > >> >> >>
> > > >> >> >>Any suggestions?
> > > >> >> >>
> > > >> >> >>Jake
> > > >> >> >>
> > > >> >> >>Tuesday, September 24, 2002, 10:21:42 AM, you wrote:
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>JK> BTW, the attachment is a .zip file.  Just save it as
> > > >> >> whatever.zip and
> > > >> >> >>JK> you should be able to open it.  Don't know why the
> > > >> extension got
> > > >> >> >>JK> mangled so bad?
> > > >> >> >>
> > > >> >> >>JK> BTW, would using configureAndWatch() be the problem?
> > > >> >> I'll test in a
> > > >> >> >>JK> second.  We use that by default.  I'll post back with
> > > >> >> my results to
> > > >> >> >>JK> running the app and *not* using configureAndWatch().
> > > >> >> >>
> > > >> >> >>JK> Jake
> > > >> >> >>
> > > >> >> >>JK> Tuesday, September 24, 2002, 8:34:09 AM, you wrote:
> > > >> >> >>
> > > >> >> >>JK>> Hi Ceki,
> > > >> >> >>
> > > >> >> >>JK>> Nope, we aren't using anything fancy like
> > > >> NTEventLogAppender.
> > > >> >> >>
> > > >> >> >>JK>> I'll attaching everything that we use in our webapp
> > > >> >> related to log4j so
> > > >> >> >>JK>> that you can see everything that is going on.  Note,
> > > >> >> we are using
> > > >> >> >>log4j-1.2.6.
> > > >> >> >>
> > > >> >> >>JK>> thanks,
> > > >> >> >>
> > > >> >> >>JK>> Jake
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>JK>> At 08:29 AM 9/24/2002 +0200, you wrote:
> > > >> >> >>
> > > >> >> >> >>>Are you using NTEventLogAppender?
> > > >> >> >> >>>
> > > >> >> >> >>>At 20:31 23.09.2002 -0500, you wrote:
> > > >> >> >> >>>
> > > >> >> >> >>>>Can someone in-the-know please comment on this?
> > > >> >> >> >>>>
> > > >> >> >> >>>>This is my last major build problem.  It really gets
> > > >> >> in the way because
> > > >> >> >> >>>>if I test my app in Tomcat (haven't tried other
> > > >> >> servers) and then
> > > >> >> >> need to
> > > >> >> >> >>>>shut the app down and rebuild after making some
> > > >> >> changes, I can't
> > > >> >> >> clean up
> > > >> >> >> >>>>the build because log4j.jar is locked and can't be
> > > >> >> deleted (I copy all
> > > >> >> >> >>>>files to a "build" directory and just delete
> the build
> > > >> >> directory when I
> > > >> >> >> >>>>want to do a clean build).
> > > >> >> >> >>>>
> > > >> >> >> >>>>Log4j.jar is the only file that is ever locked so
> > > >> >> there must be
> > > >> >> >> something
> > > >> >> >> >>>>unique about and something that isn't
> getting stopped.
> > > >> >>  Read below for
> > > >> >> >> >>>>more explanation.....
> > > >> >> >> >>>>
> > > >> >> >> >>>>Jake
> > > >> >> >> >>>>
> > > >> >> >> >>>>At 05:26 AM 9/21/2002 -0500, you wrote:
> > > >> >> >> >>>>
> > > >> >> >> >>>>>This issue has been brought up before with
> no response....
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>I use Tomcat-4.1.11 and the manager app to
> install/remove |
> > > >> >> >> >>>>>deploy/undeploy | start/stop my webapp
> which contains
> > > >> >> >> log4j-1.2.6.jar in
> > > >> >> >> >>>>>WEB-INF/lib.  What I'd like to be able to do is
> > > >> >> uninstall or undeploy
> > > >> >> >> >>>>>the webapp and run a clean build.  However, whenever
> > > >> >> I do this the
> > > >> >> >> build
> > > >> >> >> >>>>>fails because it cannot delete the log4j jar file.
> > > >>  I've used
> > > >> >> >> >>>>>LogManager.shutdown() in a ServletContextListener
> > > >> >> which will get run
> > > >> >> >> >>>>>upon being notified that the app is shutting down.
> > > >> >> This does not
> > > >> >> >> >>>>>help....well, it does help in unlocking the log file
> > > >> >> that gets written
> > > >> >> >> >>>>>while the webapp is running which gets written using
> > > >> >> a FileAppender,
> > > >> >> >> but
> > > >> >> >> >>>>>it doesn't unlock the actual log4j jar file.   The
> > > >> >> only way it gets
> > > >> >> >> >>>>>unlocked is by performing a *full* shutdown
> of Tomcat.
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>Shutting down Tomcat is unacceptable because I don't
> > > >> >> want to affect the
> > > >> >> >> >>>>>other apps running on the server.  I have worked
> > > >> >> around it by not doing
> > > >> >> >> >>>>>a full clean build and just doing a normal build
> > > >> >> which replaces files
> > > >> >> >> >>>>>that have changed.  However, this is very
> > > >> >> inconvenient because if I
> > > >> >> >> >>>>>remove files or change the names of files, I need to
> > > >> >> do a clean
> > > >> >> >> build to
> > > >> >> >> >>>>>get rid of the old ones.  Plus, I'd like to be able
> > > >> >> to zip up the build
> > > >> >> >> >>>>>directory structure or just remove the entire build
> > > >> >> from that location
> > > >> >> >> >>>>>without having to shut down Tomcat.  In both cases I
> > > >> >> get errors because
> > > >> >> >> >>>>>the log4j jar file is locked.
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>Now, I would look to Tomcat first and blame it for
> > > >> >> failing to release
> > > >> >> >> >>>>>resources.  However, I don't have this problem with
> > > >> >> *any* other file,
> > > >> >> >> >>>>>jar or otherwise.  So, it seems that Log4j must be
> > > >> >> doing something
> > > >> >> >> >>>>>peculiar.  However, I have yet to figure
> out what that is.
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>Can anyone help me figure out what this problem and
> > > >> >> its solution might
> > > >> >> >> >>>>>be?  Do we need to add a new static method called
> > > >> >> >>
> > > >>
> >>>>>LogManager.reallyShutdownNoIReallyMeanItJustShutdownAlready()?
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>Thanks,
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>Jake
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>
> > > >> >> >> >>>>>--
> > > >> >> >> >>>>>To unsubscribe,
> > > >> >> >> e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > >> >> >> >>>>>For additional commands, e-mail:
> > > >> >> >> <mailto:[EMAIL PROTECTED]>
> > > >> >> >> >>>
> > > >> >> >> >>>--
> > > >> >> >> >>>Ceki
> > > >> >> >> >>>
> > > >> >> >> >>>TCP implementations will follow a general principle of
> > > >> >> robustness: be
> > > >> >> >> >>>conservative in what you do, be liberal in what you
> > > >> accept from
> > > >> >> >> >>>others. -- Jon Postel, RFC 793
> > > >> >> >> >>>
> > > >> >> >> >>>
> > > >> >> >> >>>
> > > >> >> >> >>>--
> > > >> >> >> >>>To unsubscribe,
> > > >> >> >> e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > >> >> >> >>>For additional commands, e-mail:
> > > >> >> >> <mailto:[EMAIL PROTECTED]>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>--
> > > >> >> >>Best regards,
> > > >> >> >>  Jacob                            mailto:[EMAIL PROTECTED]
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>--
> > > >> >> >>To unsubscribe, e-mail:
> > > >> MW> <mailto:[EMAIL PROTECTED]>
> > > >> >>>For additional commands, e-mail:
> > > >> MW> <mailto:[EMAIL PROTECTED]>
> > > >>
> > > >> CG>> --
> > > >> CG>> Ceki
> > > >>
> > > >> CG>> TCP implementations will follow a general principle of
> > > >> robustness: be
> > > >> CG>> conservative in what you do, be liberal in what
> you accept from
> > > >> CG>> others. -- Jon Postel, RFC 793
> > > >>
> > > >>
> > > >>
> > > >> CG>> --
> > > >> CG>> To unsubscribe, e-mail:
> > > >> MW> <mailto:[EMAIL PROTECTED]>
> > > >> CG>> For additional commands, e-mail:
> > > >> MW> <mailto:[EMAIL PROTECTED]>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Best regards,
> > > >>  Jacob                            mailto:[EMAIL PROTECTED]
> > > >>
> > > >>
> > > >> --
> > > >> To unsubscribe, e-mail:
> > > MW> <mailto:[EMAIL PROTECTED]>
> > > MW> For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > > MW> ===8<===========End of original message text===========
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Best regards,
> > >  Jacob                            mailto:[EMAIL PROTECTED]
> > >
> > >
> >
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to