Skip to Content.
Sympa Menu

grouper-dev - Re: [grouper-dev] Strange grouper error on 1.3.0 rc1

Subject: Grouper Developers Forum

List archive

Re: [grouper-dev] Strange grouper error on 1.3.0 rc1


Chronological Thread 
  • From: Bert Bee-Lindgren <>
  • To: "Cramton, James" <>
  • Cc: <>
  • Subject: Re: [grouper-dev] Strange grouper error on 1.3.0 rc1
  • Date: Wed, 30 Apr 2008 21:39:09 -0400

I would first check to see if you have two copies of log4j in your classpath.

On Apr 30, 2008, at 4:46 PM, Cramton, James wrote:
I’m sure this is not a problem with Grouper, but with our provisioning scripts that call the Grouper API. But I’ve beat my head against this for a bit, and my brain cells are probably in mourning for Abby Hoffman, and therefore refuse to operate above par.  Any suggestions for resolving this would be welcome, and I’ll keep this as short as possible.
 
We provision our grouper from a separate Java process called from a perl script that sets up a reasonable classpath, along with other environment variables. The classpath includes the grouper.jar in our tomcat webapps directory, so we know it’s in sync with the webapp, which works fine.  When we create a GrouperSession, we get the following error, which has a null message.
 
 
 
Apr 30, 2008 4:44:15 PM edu.internet2.middleware.grouper.ErrorLog fatal
SEVERE: [edu.internet2.middleware.grouper.internal.dao.hib3.Hib3DAO] unable to initialize hibernate: null
Exception in thread "main" java.lang.ExceptionInInitializerError
        at edu.internet2.middleware.grouper.internal.dao.hib3.Hib3DAO.<clinit>(Hib3DAO.java:71)
        at edu.internet2.middleware.grouper.internal.dao.hib3.Hib3DAOFactory.getGroup(Hib3DAOFactory.java:57)
        at edu.internet2.middleware.grouper.GrouperSourceAdapter.getSubject(GrouperSourceAdapter.java:97)
        at edu.internet2.middleware.grouper.subj.SourcesXmlResolver.find(SourcesXmlResolver.java:87)
        at edu.internet2.middleware.grouper.subj.CachingResolver.find(CachingResolver.java:67)
        at edu.internet2.middleware.grouper.subj.ValidatingResolver.find(ValidatingResolver.java:61)
        at edu.internet2.middleware.grouper.SubjectFinder.findById(SubjectFinder.java:67)
        at edu.brown.grouper.GrouperUtils.newSession(Unknown Source)
        at StemInfo.main(Unknown Source)
Caused by: java.lang.NoClassDefFoundError
        at org.apache.log4j.Logger.getLogger(Logger.java:94)
        at com.mchange.v2.log.log4j.Log4jMLog.getMLogger(Log4jMLog.java:51)
        at com.mchange.v2.log.MLog.getLogger(MLog.java:145)
        at com.mchange.v2.log.MLog.<clinit>(MLog.java:72)
        at com.mchange.v2.c3p0.DataSources.<clinit>(DataSources.java:59)
        at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:154)
        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
        at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
        at edu.internet2.middleware.grouper.internal.dao.hib3.Hib3DAO.<clinit>(Hib3DAO.java:66)
        ... 8 more
 
 
Which I trace to the following lines of code in lines 46 – 57 of Hib3DAO.java:
 
abstract class Hib3DAO {
 
  // PRIVATE CLASS CONSTANTS //
  private static final Configuration  CFG;
  private static final SessionFactory FACTORY;
 
  // STATIC //
  static {
    try {
      // Find the custom configuration file
      if (Hib3DAO.class.getResource(GrouperConfig.HIBERNATE_CF) == null) {
        throw new RuntimeException("Cant find resource " + GrouperConfig.HIBERNATE_CF + ", make sure it is on the classpath.");
      }
// JFC: OK to here
      InputStream in  = Hib3DAO.class.getResourceAsStream(GrouperConfig.HIBERNATE_CF); 
      Properties  p   = new Properties();
      p.load(in);
      // And now load all configuration information
      CFG = new Configuration()
        .addProperties(p)
        .addClass(Hib3AttributeDAO.class)
        .addClass(Hib3CompositeDAO.class)
        .addClass(Hib3FieldDAO.class)
        .addClass(Hib3GroupDAO.class)
        .addClass(Hib3GroupTypeDAO.class)
        .addClass(Hib3GroupTypeTupleDAO.class)
        .addClass(Hib3GrouperSessionDAO.class)
        .addClass(Hib3MemberDAO.class)
        .addClass(Hib3MembershipDAO.class)
        .addClass(Hib3RegistrySubjectDAO.class)
        .addClass(Hib3RegistrySubjectAttributeDAO.class)
        .addClass(Hib3StemDAO.class)
        ;
      // And finally create our session factory
      FACTORY = CFG.buildSessionFactory();
// JFC: Throws an exception with a null message by here
    }
    catch (Throwable t) {
      String msg = "unable to initialize hibernate: " + t.getMessage();
      ErrorLog.fatal(Hib3DAO.class, msg);
      throw new ExceptionInInitializerError(t);
    }
  } // static
 
I’ve verified that all of the classed added in the Configuration constructor are present, as are their xml files. And again, the web interface does not have this problem, so it’s clearly something environmental about our provisioning script.
 
Thoughts on where to look next?
 
Thanks!
 
James Cramton
Lead Programmer/Analyst
401 345 9795
 




Archive powered by MHonArc 2.6.16.

Top of Page