[hibernate-users] Intermittent problem during hibernate factory initialization in tomcat

Oren Livne u0448370 at umail.utah.edu
Sat Aug 11 23:47:12 EDT 2007


Dear All,
I'm running Hibernate 3.2.4 GA inside a web application on tomcat 
6.0.14. Recently (the last two months), a LinkageError has been thrown 
during Hibernate Factory initialization about 50% of the time (almost 
always alternating between bug-no bug when restarting tomcat many times 
in a row). Could someone please help me find the problem? I am not a 
Hibernate expert. Here's the stack trace from tomcat's log:

Aug 11, 2007 9:04:31 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
21:04:33,059 INFO  DefaultResourceLocator   :135 - initializing
21:04:33,072 INFO  DefaultStopwatchEngine   : 70 - Starting engine ...
21:04:33,326 INFO  DefaultStopwatchEngine   : 81 - Engine started in 254ms.
21:04:33,328 INFO  DefaultResourceLocator   :357 - Initializing DAO 
factory 'hibernate'
21:04:37,079 ERROR HibernateSessionFactory  :144 - %%%% Error Creating 
SessionFactory %%%%
21:04:37,083 ERROR HibernateSessionFactory  :145 -  [ 
java.lang.ExceptionInInitializerError ] nul
l java.lang.ExceptionInInitializerError
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.ja
va:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccesso
rImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at 
org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:22)
        at 
org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory
.java:44)
        at 
org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
        at 
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:118)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.
java:425)
        at 
org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEnti
tyPersister.java:91)
        at 
org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58
)
        at 
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
        at 
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
        at 
net.ruready.port.eis.factory.entity.HibernateSessionFactory.rebuildSessionFactory(Hibe
rnateSessionFactory.java:135)
        at 
net.ruready.port.eis.factory.entity.HibernateSessionFactory.getSession(HibernateSessio
nFactory.java:164)
        at 
net.ruready.port.eis.factory.imports.HibernateDAOFactory.getSession(HibernateDAOFactor
y.java:303)
        at 
net.ruready.port.eis.factory.imports.HibernateDAOFactory.initialize(HibernateDAOFactor
y.java:156)
        at 
net.ruready.imports.DefaultResourceLocator.initialize(DefaultResourceLocator.java:145)
        at 
net.ruready.struts.common.imports.WebAppResourceLocator.getInstance(WebAppResourceLoca
tor.java:52)
        at 
net.ruready.port.eis.factory.imports.HibernateEISBD.<clinit>(HibernateEISBD.java:43)
        at net.ruready.user.entity.User.<clinit>(User.java:83)
        at sun.misc.Unsafe.ensureClassInitialized(Native Method)
        at 
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.jav
a:25)
        at 
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
        at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
        at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
        at java.lang.reflect.Field.getLong(Field.java:528)
        at 
java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1614)
        at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:52)
        at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:425)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
        at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
        at 
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:547)
        at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
        at 
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
        at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at 
org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1439)
        at 
org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942)
        at 
org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
        at 
org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
        at 
org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
        at 
org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4258)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at 
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
        at 
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
        at 
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117
)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at 
org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
        at 
net.ruready.common.eis.manager.DefaultEISManager.<init>(DefaultEISManager.java:48)
        at 
net.ruready.port.eis.factory.imports.HibernateEISBD.<init>(HibernateEISBD.java:58)
        at 
net.ruready.port.eis.tree.entity.PersistentTreeNode.<clinit>(PersistentTreeNode.java:8
8)
        ... 68 more

The code that causes this error is in my hibernate factory implementation:

    /**
     * Rebuild hibernate session factory
     */
    public void rebuildSessionFactory()
    {
        try
        {
            configuration
                    .configure(config
                            
.getProperty(CommonNames.RESOURCE_LOCATOR.PROPERTY.DAO_FACTORY_CONFIG_FILE_NAME));
            sessionFactory = configuration.buildSessionFactory(); 
<----------------- crash happens right here!!
        }
        catch (Exception e)
        {
            logger.error("%%%% Error Creating SessionFactory %%%%");
            logger.error(ExceptionUtil.getStackTraceAsString(e));
        }
        catch (ExceptionInInitializerError e)
        {
            logger.error("%%%% Error Creating SessionFactory %%%%");
            logger.error(ExceptionUtil.getStackTraceAsString(e));
        }
    }

The same happened with tomcat 6.0.13. My plan is to upgrade to Hibernate 
3.2.5 GA, but I don't know what else to do. I have a complicated 
configuration of jars in my web app which I suppressed here which might 
cause this -- please let me know what else you need to know about my config.

Thank you so much in advance,
Oren

-- 
==========================================================================
"The young know the rules, the old know the exceptions."
--------------------------------------------------------------------------
Oren Livne, Ph.D.
RUReady Software Architect
Academic Outreach and Continuing Education, 1901 E South Campus Dr.
Room 2197-D, University of Utah, Salt Lake City, UT 84112-9399
Tel  : (801) 581-6831     Cell: (801) 631-3885     Fax: (801) 585-5414
Email: olivne at aoce.utah.edu              Web:  http://ruready.net/oren
==========================================================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20070811/f0ff05a7/attachment.html 


More information about the hibernate-users mailing list