openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BluesBrothers <j...@objectivelogic.com>
Subject Re: Possible reasons for Persistence.createEntityManagerFactory returning null
Date Thu, 12 Nov 2009 08:01:56 GMT

Heiko,

I'm also using 1.2.1, which is the latest stable release (1.3.x is  
available as a snapshot, and 2.x is in the wings).

Yes, as nearly as I can tell, the absence of the OpenJPA JAR and the  
class(es) it contains causes a createEntityManagerFactory() call to be  
short-circuited and simply return null, rather than throwing an  
exception or attempting to log a message.

I agree: surely they could have at least thrown a runtime exception of  
some sort -- they could have at least given the hapless user some  
useful feedback. I think this is a bug, but apparently, it's been this  
way for a long time, and I doubt they're interested in addressing the  
problem.

If one had the time and inclination, one could of course open up the  
source code and find out "why" it's the way it is. I'm just thankful  
to have gotten past it! ;-)

Thanks for the feedback.



John

Mac: It just works.

"If there are no dogs in Heaven, then when I die I want to go where  
they went."  Will Rogers

"The democracy will cease to exist when you take from those who are  
willing to work and give to those who would not."  Thomas Jefferson

John N. Armstrong
Sr. Partner
Objective Logic, L.L.P.
3505 Terry Drive
Plano, TX 75023
john@objectivelogic.com
Office:  972-208-0032
Mobile: 972-529-0195
www.objectivelogic.com

On Nov 12, 2009, at 1:36 AM, Heiko [via OpenJPA] wrote:

> 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
>
> [hidden email] 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.
>
> View message @ http://n2.nabble.com/Possible-reasons-for-Persistence-createEntityManagerFactory-returning-null-tp721529p3991184.html
> To unsubscribe from Re: Possible reasons for  
> Persistence.createEntityManagerFactory returning null, click here.
>


-- 
View this message in context: http://n2.nabble.com/Possible-reasons-for-Persistence-createEntityManagerFactory-returning-null-tp721529p3991256.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message