Re: Barracuda: Patch for Log4jInit servlet

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Stefan,

See comments below...

At 08:21 AM 1/14/2003 +0100, you wrote:
>Hi Jake,
>
>see my comments below:
>Am Mon, 2003-01-13 um 15.37 schrieb Jacob Kjome:
> > Hi Stefan,
> >
> > Hmm.....
> >
> > That's curious.  When you say "deploying as a .war file" do you mean
> > to say that you used catalina's manager deploy command or did you
> > create a context that looked something like....
> >
> > <Context path="/mypath" docBase="myapp.war" />
>I'm using catalina's manager deploy using the ant taskdef. My war
>contains a META-INF/context.xml that is properly integrated into
>catalina's server.xml.
> >
> > I'm not completely sure about what happens to a deployed app when it
> > is deployed via Tomcat's manager app since I never do deploys, only
> > installs with the manager app.  The latter case where you specify the
> > docBas="myapp.war" is, under Tomcat's default settings, is the only
> > way to deploy a .war file without expanding the .war to a directory
> > structure and then deploying the directory structure.    Can you
> > explain how you deployed so that I can reproduce the error.  Sounds
> > like it may be a bug in Log4j.
> >
> > BTW, are you using the Log4j-1.2.7a.jar from Barracuda/WEB-INF/lib?
> > It isn't an official release, but contains a patch to the entity
> > resolver which makes it so that log4j.jar isn't locked after the app
> > is Tomcat manager removed from Tomcat.  In the official release of
> > logj4-1.2.7, even after a LogManager.shutdown(), the log4j.jar is
> > still locked so one can't do a clean build until Tomcat is shut down.
> > It might be good to test both the official release and the unofficial
> > logj4-1.2.7a version included in Barracuda.
>Currently I'm using 1.2.7a, the one that comes with Barracuda's CVS. I
>will try 1.2.7 and report it's behaviort.

Yes, do that.  It would be interesting to know if the problem is in the 
newer jar which contains a new org.apache.log4j.xml.Log4jEntityResolver 
class to load a local copy of log4j.dtd rather than the location specified 
in the log4j.xml file.  Although it fixed a file locking problem when the 
app is stopped and log4j.jar is in build/WEB-INF/lib and an attempt is made 
to do a clean build, it may have introduced issues elsewhere.  I guess 
we'll see when you report back upon further testing.


>BTW: Log4jInit instantiates a DOM parser. Is this a XML parser problem?
>I'm using tomcat 4.1.18 LE JDK1.4.

It does use a DOM Parser and I suppose it could be an issue as to which one 
is used....that is, is the one being used buggy?  This isn't something we 
can solve anytime soon, though.  As long as we use XMLC and XMLC is tied to 
xerces1, we'll have to live with its buggy behavior if, in fact, it is 
actually buggy.


>Among other custom jars, these guys are located inside the war:
>./WEB-INF/lib/plankton.jar
>./WEB-INF/lib/barracuda-contrib.jar
>./WEB-INF/lib/barracuda-webapp.jar
>./WEB-INF/lib/barracuda-core.jar
>./WEB-INF/lib/log4j-1.2.7a.jar
>./WEB-INF/lib/barracuda-log4j.jar
>
>In catalina's shared/lib I've put:
>./activation.jar
>./mail.jar
>./xerces-1.4.4-xmlc-2.1.jar
>./xmlc-2.1.jar
>In catalina's common/lib there's a custom JDBC wrapper driver that uses
>log4j. Therefore I have log4j.jar in common/lib too, exactly the same
>file like the on in the war. Might the two log4j jar files produce a
>conflict?

They shouldn't conflict since the WebappClassloader, unlike other 
classloaders, looks to itself for resources first before asking its parent 
classloaders for resources.  Your setup seems fine.  Note that, 
alternatively, you could put barracuda-log4j.jar in shared/lib and move the 
log4j jar out of WEB-INF/lib.  Since the init servlet sets up a custom 
repository selector, all apps will have their own logger repository even 
though log4 is static and available to all apps.  I will be commiting code 
that will improve on this soon as well, but it should work mostly fine 
right now.

> >
> > I'll apply your patch on BaracudaMVC.org (once it is up and running)
> > since the CVS at enhydra.org will not be updated anymore.
> > Jake
> >
> >

Your patch makes sense either way, so it will get committed, but getting 
some extra information based on further testing of the official log4j-1.2.7 
release as opposed to the slightly modified log4j-1.2.7a will be 
helpful.  It might even result in a bug report to Log4j?

thanks,

Jake


>Regards,
>Stefan
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/barracuda
>FAQ - http://www.jguru.com/faq/Barracuda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.