users@glassfish.java.net

Re: commons-logging classloading problem in v2-b41 ?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Thu, 05 Apr 2007 12:58:35 -0700

Kristof,



glassfish_at_javadesktop.org wrote On 04/04/07 03:29 AM,:

>Hi,
>
>I'm trying to deploy a self-written application skeleton to Glassfish-v2 b41 which uses Spring2 and Hibernate JPA. My application is packaged in a war file and all needed libraries are included in WEB-INF/lib (including commons-logging and log4j, which I'd like to use through commons-logging).
>
>The first deploy after each server restart is always successful, every upcoming redeploys end up quickly with this error:
>
>Caused by: java.lang.NullPointerException
> at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:202)
>
>which is clearly coming from this code part:
>private static Log log = LogFactory.getLog( Ejb3Configuration.class );
>...
>log.debug( "Look up for persistence unit: " + persistenceUnitName ); // nullpointerexception
>
>So it looks irrevelant to both hibernate entitymanager and the spring framework and looks like a glassfish vs commons-logging problem to me. Still, after looking around all related parties' forums and mailing lists, I tried the following:
>- added <class-loader delegate="false"/> to sun-web.xml
>- tried to place log4j and commons-logging to the glassfish domain lib dir
>
>

In the latter case, were log4j and commons-logging present in both your
webapp's WEB-INF/lib
as well as the domain's lib dir? If so, what results to you get after
removing log4j and commons-logging
from your webapp's WEB-INF/lib?


Looks like the LogFactory from commons-logging is unable to find any log
impls.

Luckily, commons-logging allows you to enable diagnostic output, by
specifying this JVM property:

  org.apache.commons.logging.diagnostics.dest

whose possible values are "STDERR", "STDOUT", or a file path.

Can you please add this JVM property to your domain.xml? Preferably, you
would want to specify a file
path as its value (instead of STDERR or STDOUT), so that the diagnostic
output will be nicely separated
into the specified file (instead of cluttering your server.log).

Please send the diagnostic output for these 2 scenarios:

- commons-logging and log4j bundled with your webapp and not present in the
   domain's lib dir
- commons-logging and log4j bundled with your webapp and also present
  in your domain's lib dir

Thanks!


Jan