-->
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.  [ 3 posts ] 
Author Message
 Post subject: Cannot initialize EntityManager ExceptionInInitializerError
PostPosted: Mon Feb 26, 2007 10:59 am 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
I am using hibernate in netbeans with ejb3 and i had all of this working but i added another persistence unit to the persistence.xml and everything seems to have stopped working now i keep getting the error below.

I tried to go back to the simpler persistence.xml even deleting it entirely and rebuilding it but i get the same error
Hibernate version:3.2.2.ga

Mapping documents:

it fails on this line of code before i even begin to start a session:
private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("Booth_StatPU");:

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at ftpImporter.downloaderGui.<init>(downloaderGui.java:24)
at ftpImporter.testFrame.<init>(testFrame.java:18)
at ftpImporter.testFrame$1.run(testFrame.java:49)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: javax.persistence.PersistenceException: java.lang.NullPointerException
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:252)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at ftpImporter.DataImporter.<clinit>(DataImporter.java:34)
... 10 more
Caused by: java.lang.NullPointerException
at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
... 14 more
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.add(ThreadGroup.java:856)
at java.lang.Thread.start(Thread.java:573)
at org.apache.tools.ant.taskdefs.ProcessDestroyer.removeShutdownHook(ProcessDestroyer.java:145)
at org.apache.tools.ant.taskdefs.ProcessDestroyer.remove(ProcessDestroyer.java:198)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:490)
at org.apache.tools.ant.taskdefs.Java.fork(Java.java:751)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:171)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:378)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:240)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:293)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
debug-single:
BUILD SUCCESSFUL (total time: 1 minute 44 seconds)


Database: FirebirdSQL 1.5


Top
 Profile  
 
 Post subject: Here is the problem but maybe someone can tell me why?
PostPosted: Mon Feb 26, 2007 1:13 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
i rebuilt my entire project again re-importing package by package to narrow down the problem after finding that the part of the application i was trying to run would run outside of my project.

I found it was an unrelated error in another part of the application that had nothing to do with my ftpImporter package. It's kinda of strange because even though ftpImporter does not initialize the class CollectionCC anywhere at anytime even indirectly an error on this line in CollectionCC which references a non-existent persistance unit:

Code:
private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("CollectionEntryPU");


if i change it to an existing persistance unit
Code:
private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("Collection_ReporterPU");


now it works but why would this be even though like i said nothing ever initializes CollectionCC. Well i should say what is initializing it?

Does anybody know why?[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 7:25 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
There are 2 bugs related to OneToOne and NPE that I fixed in SVN, you probably reached one.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.