-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: ExceptionInInitializerError
PostPosted: Wed Jan 13, 2010 10:10 am 
Newbie

Joined: Thu Oct 29, 2009 2:59 am
Posts: 10
Hello,

I have a problem according to use the hibernate framework with the tomcat server. If I start my web application, I get the exception below -> if an exception occures than the tomcat server starts once again, and with the second launch all works fine,

Actually I have no idea, why this exception happens, if I had something misconfigured, than it wouldn't still work at the second time, but it works at the second time.
Could it be that I have some timing problem, because I use also the Spring Framework but in my case the Spring Framework doesn't support the Hibernate Framework, this means they are not connected.

Thanks for any help,
All the best,
Generic1


Code:
Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
        at net.test.hibernate.BasicManager.getSession(BasicManager.java:28)
        at net.test.hibernate.EventManager.storeLogging(EventManager.java:37)
        at net.test.hibernate.DatabaseInterface.createAndStoreLogging(DatabaseInterface.java:43)
        at net.test.hibernate.StartDatabase.createAndStoreLogging(StartDatabase.java:185)
        at net.test.service.StartService.<init>(StartService.java:17)
        at net.test.contextlistener.ContextListener$1.run(ContextListener.java:22)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource net/test/hibernate/tTrend.hbm.xml
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
        at net.test.hibernate.InitSessionFactory.<clinit>(InitSessionFactory.java:16)
        ... 6 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
        at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:555)
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
        ... 12 more
Caused by: org.dom4j.DocumentException: null Nested exception: null
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:546)
        ... 13 more
13.01.2010 14:57:43 org.hibernate.cfg.Configuration addResource



Top
 Profile  
 
 Post subject: Re: ExceptionInInitializerError
PostPosted: Wed Jan 13, 2010 3:19 pm 
Senior
Senior

Joined: Mon Jul 07, 2008 4:35 pm
Posts: 141
Location: Berlin
Hi Generic1,

looks like your org.dom4j.io.SAXReader is receiving null instead of a valid XML mapping file. You should ensure that the file net/test/hibernate/tTrend.hbm.xml is available when it is attempted to be added as a mapping resource.

If you cannot ensure that you might want to wrap a null or availability check around your mapping files to circumvent the exception from occuring. Note, that this might cause problems later when mapping resources are required that haven't been added before.

CU
Froestel

_________________
Have you tried turning it off and on again? [Roy]


Top
 Profile  
 
 Post subject: Re: ExceptionInInitializerError
PostPosted: Thu Jan 14, 2010 10:22 am 
Newbie

Joined: Thu Oct 29, 2009 2:59 am
Posts: 10
Hello Froestel,

thanks for your reply!
Do you have a hint, how and where respectively I can ensure that the file net/test/hibernate/tTrend.hbm.xml is available when it is attempted to be added as a mapping resource? Because the file is always there in my application, Actually I don't know why the Hibernate Framework can't find the file?
Or how and where can I check around the mapping files to circumvent the exception from occuring?

Thanks and all the best,
Generic

Code:
public synchronized Session getSession() {                                               
        if (factory == null) {           
            factory = InitSessionFactory.getInstance();  // here the exception below occures
            }
        return factory.getCurrentSession();
        }


Code:
Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
        at net.test.hibernate.BasicManager.getSession(BasicManager.java:28)
        at net.test.hibernate.EventManager.storeLogging(EventManager.java:37)
        at net.test.hibernate.DatabaseInterface.createAndStoreLogging(DatabaseInterface.java:43)
        at net.test.hibernate.StartDatabase.createAndStoreLogging(StartDatabase.java:185)
        at net.test.service.StartService.<init>(StartService.java:24)
        at net.test.contextlistener.ContextListener$1.run(ContextListener.java:22)
Caused by: java.lang.NullPointerException
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1634)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
        at net.testhibernate.InitSessionFactory.<clinit>(InitSessionFactory.java:16)
        ... 6 more
14.01.2010 15:16:39 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: net.test.hibernate.TLogin -> TLogin



Top
 Profile  
 
 Post subject: Re: ExceptionInInitializerError
PostPosted: Fri Jan 15, 2010 5:26 am 
Newbie

Joined: Thu Oct 29, 2009 2:59 am
Posts: 10
I have tried out something but it doesn't improve the situtation,
Do you have a tip what I could do more?
All the best,
Generic


Top
 Profile  
 
 Post subject: Re: ExceptionInInitializerError
PostPosted: Fri Jan 15, 2010 1:42 pm 
Newbie

Joined: Fri Jan 15, 2010 1:35 pm
Posts: 1
Do you use Vista? I had the same problem, and I could only solve it by changing pc!
C.


Top
 Profile  
 
 Post subject: Re: ExceptionInInitializerError
PostPosted: Mon Jan 18, 2010 4:06 am 
Newbie

Joined: Thu Oct 29, 2009 2:59 am
Posts: 10
No, I'am using Windows XP, but I have no idea what I could do to resolve the problem.
So I am glad for any idea.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.