Beware of those runtime dependencies

Okay, well maybe it wasn’t as “suddenly” – changes had been made to the system. Big changes. The active Tomcat instance had ben upgraded from version 4.1.30 to 5.5.12 which apparently changes some runtime dependencies for Realms. One might have guessed since it’s a jump of two major versions (first 5.0.x and then 5.5.x).

The Realm I created extended org.apache.catalina.realm.RealmBase and used the protected debug variable to control debug information written to the (console) log. After spending a fair amount of time debugging the (more or less) cryptic error the solution to the error caused to be one of those “Doh!”-moments.

The error stacktrace in catalina.out was as follows:

Feb 7, 2006 4:32:35 PM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.NoSuchFieldError: debug
        at dk.acme.guide.login.LdapDbRealm.getConnection(LdapDbRealm.java:324)
        at dk.acme.guide.login.LdapDbRealm.authenticate(LdapDbRealm.java:161)
        at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:256)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        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.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:744)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:674)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:866)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:534)

The Tomcat 5.5.12 source have moved to Jakarta commons logging for all the core classes and hence the debug variable of the org.apache.catalina.realm.RealmBase class had been removed from the source. Since I had not recompiled against the Tomcat 5.5.x source (which one could say is my fault) I hadn’t caught the problem. Changing my code to use commons logging (the log variable) and recompiling against the Tomcat 5.5.x source the problem was solved and i was happy campers once more.

Lessons learned:

  • Beware of dependencies calculated at runtime.
  • Always recompile custom code against the third-party source it depends on when doing major version upgrades.
  • Think McFly, think!!

Note: As an aside the basic way to develop and deploy a Realm in Tomcat 5.5.x is still the same as in Tomcat 4.1.x.

The VIEW article published

I’m very proud of myself (I’m patting myself on the back as I write this)… πŸ™‚

My very first article has been published in The VIEW this month and I didn’t even get to be the first to blog about it. Jens Polster beat me to it…

Jens – thank you for the kind words, the very nice post and all the comments and feedback on LotusScript.doc. Great finally meeting you at Lotusphere.

Use SnagIt! as a COM server

Talk about redesigning for reusability: Using SnagIt! as a COM server. One thing is developing it as a COM component, another is exposing and documenting the API.

If you are not familiar with SnagIt! it is a screen capture application for Windows and it is so cool – by far the best screen capture application I have ever used and purchased. If you find yourself doing a lot a screen capturing for documentation etc. I really recommend it.

Some thoughts on the evaluation forms at Lotusphere 2006

Below is my comment to Rockys post. If you have comments to the below lets keep the thread over at Rockys blog.


Rocky,

in the wake of the various blogging presenters have been making their evaluation results public, I have been thinking a little about the evaluation forms at Lotusphere. Of cause I don't know how the other scores look so take the below with a grain of salt...

Although I agree that many of the presentations and the presenters were in fact excellent I think the evaluation form lacks options and that it shines through in the published scores. I really think that question 1 ("How would you rate the quality and relevance of the information in the session/BOF?") and question 3 ("How would you rate the quality and effectiveness of the speaker(s)/facilitator(s)?") lacks a fourth option where one could indicate that the speaker wasn't really doing a good job.

While I recognize that given too many options it is sometimes difficult to choose the correct answer, I still think that only giving people options for positive feedback doesn't really suffice. I know one have the option of commenting on specific sessions and giving ones opinion in prose I still think that it twists the results of the evaluation if I have to give at least a "Fair" evaluation. Sometimes a "Dissapointing" or similar option would be nice. At the end of the day, to get an overall picture of the event, you would have to look at the overall picture of the response and here comments don't really get through unless I, as the one responding, can couple it with a score of "Disapointing" or similar.

Another option would be to go the other way and to restrict the number of options from 3 ("Excellent", "Good", "Fair") to 2 ("Above expectations", "Below expectations"). Only having two options would really make people make a choice. I recognize that it also makes the responses less fine grained.

I'm not really educated in making feedback forms or in statistics but i think it could be worth looking into whether the evalutation forms tell you what you want to know. Given that a person is more likely to publish his/her evalution if they are all good, I think that an overall score of 95% "Excellent" is a problem. The score should probably be as in school where the majority of presenters would receive a "Good" score and a minority receive an "Excellent" score (the famous "Camel"/"Bell" curve). Otherwise it devaluates the "Excellent" score.

Just some thoughts.

Firefox 1.5.0.1 released

Here’s what’s new in Firefox 1.5.0.1 (here is a complete list of fixes):

  • Improved stability.
  • Improved support for Mac OS X.
  • International Domain Name support for Iceland (.is) is now enabled.
  • Fixes for several memory leaks.
  • Several security enhancements.

Note: I had to manually uninstall and reinstall the Venkman JavaScript debugger in order for me to make it work under 1.5.0.1.

Clarifying the use of SessionFactory

As mentioned previously I have started using a SessionFactory approach when working with session to Domino using Corba/DIIOP. I forgot forever to mention that you should really combine the use of the SessionFactory with a servlet filter to recycle() the session once the thread has completed. The filter could be as simple as this:

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import dk.horisontnet.domino.SessionFactory;

public class CloseSessionFilter implements Filter {

   public void init(FilterConfig config) throws ServletException {
   }

   public void destroy() {
   }

   public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                                            throws IOException, ServletException {
      // do work from other filters
      chain.doFilter(req, res);

      // close session
      SessionFactory.closeSession();
   }
}

The above filter uses a new method in the SessionFactory class called closeSession():

public static void closeSession() {
   try {
      // declarations
      Session session = null;

      // look for a session in the thread local
      session = (Session)pSession.get();
      if (null != session) {
         session.recycle();
         pSession.set(null);
      }
   } catch (Exception e) {
      // do nothing but log it
      logger.warn("Exception thrown while closing session to Domino", e);
   }
}

Deploy the filter via web.xml as described previously.

Update on 13/Feb/06: Remember to nullify the ThreadLocal (code in bold above) after recycling the Domino session to avoid having a recycled session being reused once the thread is reused from Tomcats thread pool. Failure to do so will result in the dreaded “Object no longer exists on server”-NotesException.

Where do people shop i Washington DC?

After Lotusphere I have been spending some days driving around Florida more specifically going to Tampa, St. Petersburg, Naples, Everglades, Key West, Kennedy Space Center and Daytona Beach. Now I’m in DC where I’m going to spend a couple of days before leaving for Copenhagen on Friday afternoon.

One question though – where do people shop in DC? I’m really looking for some shops with sunglasses and clothes in general but have been unable to find any. I guess it is because I’m staying in a business part of the city (I’m staying near the Washington Monument).

If anyone has any pointers I would really be grateful. I guess I need to take the subway or similar to get out of the central part of town but some general directions would be nice… πŸ™‚

As an aside – I have spent the day (re-)seeing the sights (was in DC a couple of years ago) and it really seems that every other shop in DC is either a coffee shop (it seems like Starbucks really has a stronghold here) or a deli selling sandwiches. Quite amazing actually…