Archive for the ‘Tomcat’ Category

Solr is a great piece of software but its logging is bloody annoying. Defaultwise on my Tomcat, it will write all its log messages to the system out log, which is a pain in the but to say the least.

To make it log to its own log file, this is what I did to tomcat/conf/logging.properties

# added 6localhost.org.apache.juli.FileHandler to the list of handlers

6localhost.org.apache.juli.FileHandler.level = FINE
6localhost.org.apache.juli.FileHandler.directory = /var/log/escenic
6localhost.org.apache.juli.FileHandler.prefix = solr.


Now, I get all solr messages in /var/log/escenic/solr-2009-07-22.log. What a relief! Of course, you may want to drop the logging level to WARNING

Read Full Post »

Tomcat’s classloaders

I don’t know if this is “works as specified”, but it seems a wee bit odd to me:

  1. MyClient in tomcat/webapps/myapp/WEB-INF/lib/myjar.jar uses MyClass
  2. MyClass resides in tomcat/lib/my-other-jar.jar
  3. MyClient finds MyClass, which resides in the other (shared) classloader.
  4. However, MyClass extends a class in tomcat/webapps/myapp/WEB-INF/lib/myjar.jar – which then cannot be found.

So, maybe this is obvious? Classes in a webapps classloader can access the common and shared classloaders, but not the way around, even when the originating dependency hunt started within the webapp where the topmost (or some of) dependecy exists.

Read Full Post »

Tomat is creepy

I love Tomcat, but it really gives me the creeps sometimes. Using the latest 6.0.14 release, I’ve been linking my log4j configuration from $CATALINA_HOME/lib/trace.properties to whereever it actually resides.

The symlinking of both JAR libraries and trace.properties has always been fine. Now, all of a sudden, my logging config didn’t work anymore. I had been using the same setup the whojle day. All of a sudden, after five hours of work it seized to work. After some trial and error, I removed the symlink and copied the trace.properties into lib/ instead. All of a sudden the logging worked again (!)

And it’s not that symlinking from CATALINA_HOME/lib doesn’t work anymore, the JARs are picked up just fine. It’s just the trace.properties file that is no longer allowed to be symlinked. WHAT IS HAPPENING HERE?!!

Read Full Post »

Tomcat kept throwing annoying NoClassDefFoundErrors at me although the class was in a jar that resided in webapp classpath (a jar in mywebapp/WEB-INF/lib). Also, it didn’t happen all the time, just “often”. Restarting the server sometimes helped, sometimes not. Testing the same webapp on the Resin app server gave no such errors.

To my (so far) great positive surprise, an upgrade from Apache Tomcat 6.0.10 to 6.0.14 seems to have remedied it. Excellent! It’s amazing how such basic things can make you smile 🙂

Read Full Post »