Hello, this problem even occurs if you try to create a factory with a persistence unit that is not listed in the persistence.xml. I once had the problem that I called my persistent unit name 'Foo', and by mistake used 'FOO' when creating the factory.
Again, this is silently ignored and null is returned. In such a severe thing, I'd prefer to have an Exception being thrown. Has this changed in newer releases? Currently, I'm using 1.2.1. Regards, Heiko -- Dr.-Ing. Heiko Kopp [email protected] schrieb am 12.11.2009 04:20:34: > > KK, > > I realize that this thread is over a year old, but I had to thank you for > posting the resolution to your problem. I had the same issue (createEMF() > silently returned null) and had searched for a long time before happening > upon this thread. I did the same thing: I overlooked the obvious: the > openjpa.jar file is located in a top-level directory above the other > dependent jars, and I had neglected to copy it to my lib/ folder. Without > any exception or messages to go by, I was completely stumped as to why > OpenJPA seemed to ignore my persistence.xml file and return null for the > EMF. Anyway, I found and copied the missing JAR file, and voila! I put an > end to several hours of wasted time. ;-) > > > Kamlesh123 wrote: > > > > Thanks Kevin, > > > > Sorry for replying late. The emf was coming as null because I have not set > > the jar openjpa-1.1.0.jar in the classpath. Actually in OpenJPA > > distribution there is a lib folder containg some other jars. I have > > assumed that all the required libraries are in the lib folder and did not > > bother to see that there is one more jar lying on the root. > > > > Regards, > > KK > > > > -- > View this message in context: http://n2.nabble.com/Possible-reasons- > for-Persistence-createEntityManagerFactory-returning-null- > tp721529p3990562.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. If you are not the intended addressee, please inform us immediately that you have received this e-mail in error, and delete it. We thank you for your cooperation.
