RE: Testing an OpenJPA module

2007-04-11 Thread Patrick Linskey
 If a provider does not qualify as the provider for the named 
 persistence unit, 
 it must return null when createEntityManagerFactory is invoked on it.

That's what the provider must do when
PersistenceProvider.createEntityManagerFactory() is called, not what the
Persistence class must do.

As you can see in the code, Persistence already throws exceptions if it
can't find any persistence units. It could just be a bit more
informative about why. 

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, April 10, 2007 5:10 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: Testing an OpenJPA module
 
 It's pretty much defined by the spec that Persistence class 
 just delegates to 
 the providers to do the work and has no way to report the errors:
 
 7.2 Bootstrapping in Java SE Environments
 
 The Persistence bootstrap class will locate all of the 
 persistence providers 
 ... and call createEntityManagerFactory() on them in turn 
 until an appropriate
 backing provider returns an EntityManagerFactory.
 ...
 If a provider does not qualify as the provider for the named 
 persistence unit, 
 it must return null when createEntityManagerFactory is invoked on it.
 
 regards,
 -marina
 
 Craig L Russell wrote:
  FYI, Persistence is an open source project at Glassfish.
  
  Anyone, even an OpenJPA contributor, who wants to 
 contribute to the  
  project for example to improve the error messages, is 
 welcome to look  
  at the sources and provide a patch. I know people who will 
 be happy  to 
  commit usability patches. ;-)
  
  Craig
  
  On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:
  
  The error message could have been more specific in the 
 following way:
  a) no META-INF/persistence.xml has not been found in classpath
  b) META-INF/persistence.xml has been found but there is no 
 'ode-store'
  unit defined in it.
  c)  META-INF/persistence.xml has been found but provider can not be
  loaded/invoked
 
  When I first encountered this error, my interpreation was 
 (b) from the
  way the message was worded.
 
 
  Pinaki Poddar
  BEA Systems
  415.402.7317
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
 Behalf Of Jacek
  Laskowski
  Sent: Tuesday, April 10, 2007 2:52 PM
  To: open-jpa-dev@incubator.apache.org
  Subject: Re: Testing an OpenJPA module
 
  On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:
 
 
  Glad you got it fixed. It's annoying that
  javax.persistence.Persistence doesn't provide more of a 
 clue as to  why
 
 
  it failed.
 
 
  I wonder what else you'd like to see other than what's 
 already printed
  out? It tells exactly why it's failed - No Persistence 
 provider for
  EntityManager named ode-store is just a JPA version of
  NoClassDefFoundError in pure Java.
 
  Jacek
 
  -- 
  Jacek Laskowski
  http://www.JacekLaskowski.pl
 
  Notice:  This email message, together with any attachments, may  
  contain information  of  BEA Systems,  Inc.,  its 
 subsidiaries   and  
  affiliated entities,  that may be confidential,  proprietary,   
  copyrighted  and/or legally privileged, and is intended 
 solely for  
  the use of the individual or entity named in this message. 
 If you  are 
  not the intended recipient, and have received this message 
 in  error, 
  please immediately return this by email and then delete it.
  
  
  Craig Russell
  Architect, Sun Java Enterprise System 
 http://java.sun.com/products/jdo
  408 276-5638 mailto:[EMAIL PROTECTED]
  P.S. A good JDO? O, Gasp!
  
 
 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.


RE: Testing an OpenJPA module

2007-04-11 Thread Patrick Linskey
From findAllProviders():

EnumerationURL resources = 
loader.getResources(META-INF/services/ +
PersistenceProvider.class.getName());

If no resources are found, we've got a useful nugget of information: no
persistence providers are available in the current classloader.

Later in findAllProviders():

for (String s : names) {
try{
 
providers.add((PersistenceProvider)loader.loadClass(s).newInstance());
} catch (ClassNotFoundException exc){
} catch (InstantiationException exc){
} catch (IllegalAccessException exc){
}
}

In each of these catch blocks, we're throwing away information. If we
get an exception here, it means that a resource was listed in the
services lookup, but one of the classes listed wasn't loadable.


From createEntityManagerFactory():

try{
findAllProviders();
} catch (IOException exc){};

It's unclear why this IOException would be consumed. It is propagated up
from the findAllProviders() resource-lookup code. Again, this is useful
information for the exception that's thrown later.


IMO, the methods in this class should do a better job of tracking
problems as they happen, and using this information for notifying the
calling code about why a failure might have happened. I would recommend
using the cause slot in the thrown exception for more detail, and
putting more descriptive text in place for certain common cases.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

___
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, April 11, 2007 10:11 AM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: Testing an OpenJPA module
 
 Are we looking at different classes? I can't find the code in 
 javax.persistence.Persistence under GlassFish that looks up 
 persistence units. 
 It's all delegated to the providers.
 
 thanks,
 -marina
 
 Patrick Linskey wrote:
 If a provider does not qualify as the provider for the named 
 persistence unit, 
 it must return null when createEntityManagerFactory is 
 invoked on it.
  
  
  That's what the provider must do when
  PersistenceProvider.createEntityManagerFactory() is called, 
 not what the
  Persistence class must do.
  
  As you can see in the code, Persistence already throws 
 exceptions if it
  can't find any persistence units. It could just be a bit more
  informative about why. 
  
  -Patrick
  
 
 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.


Re: Testing an OpenJPA module

2007-04-11 Thread Marina Vatkina
Are we looking at different classes? I can't find the code in 
javax.persistence.Persistence under GlassFish that looks up persistence units. 
It's all delegated to the providers.


thanks,
-marina

Patrick Linskey wrote:
If a provider does not qualify as the provider for the named 
persistence unit, 
it must return null when createEntityManagerFactory is invoked on it.



That's what the provider must do when
PersistenceProvider.createEntityManagerFactory() is called, not what the
Persistence class must do.

As you can see in the code, Persistence already throws exceptions if it
can't find any persistence units. It could just be a bit more
informative about why. 


-Patrick





Re: Testing an OpenJPA module

2007-04-11 Thread Craig L Russell

Hi Pinaki,

On Apr 10, 2007, at 6:44 PM, Pinaki Poddar wrote:


provide a patch.

Will such a patch be given to Glassfish project?
But some kind of committer-level privilege will be required, i  
suppose.


have added few more informative messages to distinguish between
different ways persistence unit creation/ lookup can fail.
please advise on how to proceed on contributing a patch.


This is great. Can you please file a Glassfish/persistence issue in  
their issue tracker and attach your patch? If you have trouble doing  
this, I'll be glad to help some more...


Thanks!

Craig



Pinaki Poddar
BEA Systems
415.402.7317


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 10, 2007 4:14 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

FYI, Persistence is an open source project at Glassfish.

Anyone, even an OpenJPA contributor, who wants to contribute to the
project for example to improve the error messages, is welcome to  
look at

the sources and provide a patch. I know people who will be happy to
commit usability patches. ;-)

Craig

On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:


The error message could have been more specific in the following way:
a) no META-INF/persistence.xml has not been found in classpath
b) META-INF/persistence.xml has been found but there is no 'ode- 
store'

unit defined in it.
c)  META-INF/persistence.xml has been found but provider can not be
loaded/invoked

When I first encountered this error, my interpreation was (b) from  
the

way the message was worded.


Pinaki Poddar
BEA Systems
415.402.7317


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek
Laskowski
Sent: Tuesday, April 10, 2007 2:52 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Glad you got it fixed. It's annoying that
javax.persistence.Persistence doesn't provide more of a clue as to
why



it failed.


I wonder what else you'd like to see other than what's already  
printed

out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Notice:  This email message, together with any attachments, may
contain information  of  BEA Systems,  Inc.,  its subsidiaries
and  affiliated entities,  that may be confidential,  proprietary,
copyrighted  and/or legally privileged, and is intended solely for
the use of the individual or entity named in this message. If you
are not the intended recipient, and have received this message in
error, please immediately return this by email and then delete it.


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!


Notice:  This email message, together with any attachments, may  
contain information  of  BEA Systems,  Inc.,  its subsidiaries   
and  affiliated entities,  that may be confidential,  proprietary,   
copyrighted  and/or legally privileged, and is intended solely for  
the use of the individual or entity named in this message. If you  
are not the intended recipient, and have received this message in  
error, please immediately return this by email and then delete it.


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


RE: Testing an OpenJPA module

2007-04-11 Thread Pinaki Poddar
Hello Craig,
   Done.
   Thanks for your advice. 

   Please review:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2814

Pinaki Poddar
BEA Systems
415.402.7317  


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 11, 2007 5:11 PM
To: open-jpa-dev@incubator.apache.org
Cc: cmp-dev
Subject: Re: Testing an OpenJPA module

Hi Pinaki,

On Apr 10, 2007, at 6:44 PM, Pinaki Poddar wrote:

 provide a patch.
 Will such a patch be given to Glassfish project?
 But some kind of committer-level privilege will be required, i 
 suppose.

 have added few more informative messages to distinguish between 
 different ways persistence unit creation/ lookup can fail.
 please advise on how to proceed on contributing a patch.

This is great. Can you please file a Glassfish/persistence issue in
their issue tracker and attach your patch? If you have trouble doing
this, I'll be glad to help some more...

Thanks!

Craig


 Pinaki Poddar
 BEA Systems
 415.402.7317


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 10, 2007 4:14 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: Testing an OpenJPA module

 FYI, Persistence is an open source project at Glassfish.

 Anyone, even an OpenJPA contributor, who wants to contribute to the 
 project for example to improve the error messages, is welcome to look 
 at the sources and provide a patch. I know people who will be happy to

 commit usability patches. ;-)

 Craig

 On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:

 The error message could have been more specific in the following way:
 a) no META-INF/persistence.xml has not been found in classpath
 b) META-INF/persistence.xml has been found but there is no 'ode- 
 store'
 unit defined in it.
 c)  META-INF/persistence.xml has been found but provider can not be 
 loaded/invoked

 When I first encountered this error, my interpreation was (b) from 
 the way the message was worded.


 Pinaki Poddar
 BEA Systems
 415.402.7317


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek

 Laskowski
 Sent: Tuesday, April 10, 2007 2:52 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: Testing an OpenJPA module

 On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:

 Glad you got it fixed. It's annoying that 
 javax.persistence.Persistence doesn't provide more of a clue as to 
 why

 it failed.

 I wonder what else you'd like to see other than what's already 
 printed out? It tells exactly why it's failed - No Persistence 
 provider for EntityManager named ode-store is just a JPA version of 
 NoClassDefFoundError in pure Java.

 Jacek

 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl

 Notice:  This email message, together with any attachments, may 
 contain information  of  BEA Systems,  Inc.,  its subsidiaries and  
 affiliated entities,  that may be confidential,  proprietary, 
 copyrighted  and/or legally privileged, and is intended solely for 
 the use of the individual or entity named in this message. If you are

 not the intended recipient, and have received this message in error, 
 please immediately return this by email and then delete it.

 Craig Russell
 Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!


 Notice:  This email message, together with any attachments, may  
 contain information  of  BEA Systems,  Inc.,  its subsidiaries   
 and  affiliated entities,  that may be confidential,  proprietary,   
 copyrighted  and/or legally privileged, and is intended solely for  
 the use of the individual or entity named in this message. If you  
 are not the intended recipient, and have received this message in  
 error, please immediately return this by email and then delete it.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.


Re: Testing an OpenJPA module

2007-04-10 Thread Jacek Laskowski

On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Glad you got it fixed. It's annoying that
javax.persistence.Persistence doesn't provide more of a clue as to
why it failed.


I wonder what else you'd like to see other than what's already printed
out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl


Re: Testing an OpenJPA module

2007-04-10 Thread Marc Prud'hommeaux


Lot's of things could have gone wrong: there might be no META-INF/ 
persistence.xml file at all, it could have listed a missing provider  
class, or it could have a valid class, but one that had problems  
loading (due to a missing dependency).



On Apr 10, 2007, at 12:52 PM, Jacek Laskowski wrote:


On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Glad you got it fixed. It's annoying that
javax.persistence.Persistence doesn't provide more of a clue as to
why it failed.


I wonder what else you'd like to see other than what's already printed
out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl




RE: Testing an OpenJPA module

2007-04-10 Thread Pinaki Poddar
The error message could have been more specific in the following way:
a) no META-INF/persistence.xml has not been found in classpath
b) META-INF/persistence.xml has been found but there is no 'ode-store'
unit defined in it.
c)  META-INF/persistence.xml has been found but provider can not be
loaded/invoked 

When I first encountered this error, my interpreation was (b) from the
way the message was worded.


Pinaki Poddar
BEA Systems
415.402.7317  


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek
Laskowski
Sent: Tuesday, April 10, 2007 2:52 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:

 Glad you got it fixed. It's annoying that 
 javax.persistence.Persistence doesn't provide more of a clue as to why

 it failed.

I wonder what else you'd like to see other than what's already printed
out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.


Re: Testing an OpenJPA module

2007-04-10 Thread Jacek Laskowski

On 4/10/07, Pinaki Poddar [EMAIL PROTECTED] wrote:

The error message could have been more specific in the following way:
a) no META-INF/persistence.xml has not been found in classpath
b) META-INF/persistence.xml has been found but there is no 'ode-store'
unit defined in it.
c)  META-INF/persistence.xml has been found but provider can not be
loaded/invoked


Thanks! I've never thought about such an exhaustive list of possible
problems one might run into. Nice to keep it handy.


When I first encountered this error, my interpreation was (b) from the
way the message was worded.


Perhaps it's because I'm a mere developer so the only answer I'd have
given would've been c) yet I knew others were possible too (just I
don't see them so often).

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl


Re: Testing an OpenJPA module

2007-04-10 Thread Craig L Russell

FYI, Persistence is an open source project at Glassfish.

Anyone, even an OpenJPA contributor, who wants to contribute to the  
project for example to improve the error messages, is welcome to look  
at the sources and provide a patch. I know people who will be happy  
to commit usability patches. ;-)


Craig

On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:


The error message could have been more specific in the following way:
a) no META-INF/persistence.xml has not been found in classpath
b) META-INF/persistence.xml has been found but there is no 'ode-store'
unit defined in it.
c)  META-INF/persistence.xml has been found but provider can not be
loaded/invoked

When I first encountered this error, my interpreation was (b) from the
way the message was worded.


Pinaki Poddar
BEA Systems
415.402.7317


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek
Laskowski
Sent: Tuesday, April 10, 2007 2:52 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Glad you got it fixed. It's annoying that
javax.persistence.Persistence doesn't provide more of a clue as to  
why



it failed.


I wonder what else you'd like to see other than what's already printed
out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Notice:  This email message, together with any attachments, may  
contain information  of  BEA Systems,  Inc.,  its subsidiaries   
and  affiliated entities,  that may be confidential,  proprietary,   
copyrighted  and/or legally privileged, and is intended solely for  
the use of the individual or entity named in this message. If you  
are not the intended recipient, and have received this message in  
error, please immediately return this by email and then delete it.


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


Re: Testing an OpenJPA module

2007-04-10 Thread Marina Vatkina
It's pretty much defined by the spec that Persistence class just delegates to 
the providers to do the work and has no way to report the errors:


7.2 Bootstrapping in Java SE Environments

The Persistence bootstrap class will locate all of the persistence providers 
... and call createEntityManagerFactory() on them in turn until an appropriate

backing provider returns an EntityManagerFactory.
...
If a provider does not qualify as the provider for the named persistence unit, 
it must return null when createEntityManagerFactory is invoked on it.


regards,
-marina

Craig L Russell wrote:

FYI, Persistence is an open source project at Glassfish.

Anyone, even an OpenJPA contributor, who wants to contribute to the  
project for example to improve the error messages, is welcome to look  
at the sources and provide a patch. I know people who will be happy  to 
commit usability patches. ;-)


Craig

On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:


The error message could have been more specific in the following way:
a) no META-INF/persistence.xml has not been found in classpath
b) META-INF/persistence.xml has been found but there is no 'ode-store'
unit defined in it.
c)  META-INF/persistence.xml has been found but provider can not be
loaded/invoked

When I first encountered this error, my interpreation was (b) from the
way the message was worded.


Pinaki Poddar
BEA Systems
415.402.7317


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek
Laskowski
Sent: Tuesday, April 10, 2007 2:52 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:



Glad you got it fixed. It's annoying that
javax.persistence.Persistence doesn't provide more of a clue as to  why




it failed.



I wonder what else you'd like to see other than what's already printed
out? It tells exactly why it's failed - No Persistence provider for
EntityManager named ode-store is just a JPA version of
NoClassDefFoundError in pure Java.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Notice:  This email message, together with any attachments, may  
contain information  of  BEA Systems,  Inc.,  its subsidiaries   and  
affiliated entities,  that may be confidential,  proprietary,   
copyrighted  and/or legally privileged, and is intended solely for  
the use of the individual or entity named in this message. If you  are 
not the intended recipient, and have received this message in  error, 
please immediately return this by email and then delete it.



Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!





RE: Testing an OpenJPA module

2007-04-10 Thread Pinaki Poddar
  provide a patch.
Will such a patch be given to Glassfish project? 
But some kind of committer-level privilege will be required, i suppose.

have added few more informative messages to distinguish between
different ways persistence unit creation/ lookup can fail. 
please advise on how to proceed on contributing a patch.   


Pinaki Poddar
BEA Systems
415.402.7317  


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 10, 2007 4:14 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Testing an OpenJPA module

FYI, Persistence is an open source project at Glassfish.

Anyone, even an OpenJPA contributor, who wants to contribute to the
project for example to improve the error messages, is welcome to look at
the sources and provide a patch. I know people who will be happy to
commit usability patches. ;-)

Craig

On Apr 10, 2007, at 1:54 PM, Pinaki Poddar wrote:

 The error message could have been more specific in the following way:
 a) no META-INF/persistence.xml has not been found in classpath
 b) META-INF/persistence.xml has been found but there is no 'ode-store'
 unit defined in it.
 c)  META-INF/persistence.xml has been found but provider can not be
 loaded/invoked

 When I first encountered this error, my interpreation was (b) from the
 way the message was worded.


 Pinaki Poddar
 BEA Systems
 415.402.7317


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek
 Laskowski
 Sent: Tuesday, April 10, 2007 2:52 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: Testing an OpenJPA module

 On 4/10/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:

 Glad you got it fixed. It's annoying that
 javax.persistence.Persistence doesn't provide more of a clue as to  
 why

 it failed.

 I wonder what else you'd like to see other than what's already printed
 out? It tells exactly why it's failed - No Persistence provider for
 EntityManager named ode-store is just a JPA version of
 NoClassDefFoundError in pure Java.

 Jacek

 --
 Jacek Laskowski
 http://www.JacekLaskowski.pl

 Notice:  This email message, together with any attachments, may  
 contain information  of  BEA Systems,  Inc.,  its subsidiaries   
 and  affiliated entities,  that may be confidential,  proprietary,   
 copyrighted  and/or legally privileged, and is intended solely for  
 the use of the individual or entity named in this message. If you  
 are not the intended recipient, and have received this message in  
 error, please immediately return this by email and then delete it.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.


Re: Testing an OpenJPA module

2007-04-09 Thread Marc Prud'hommeaux

Matthieu-

Note that there shouldn't be any problem with running against a  
directory versus a jar (I do it all the time), so there is probably  
some environment issue.


Can you post your persistence.xml? If you write a little main()  
method that just does: System.out.println(getClass().getResource(/ 
META-INF/persistence.xml), what does it show?




On Apr 9, 2007, at 11:54 AM, Matthieu Riou wrote:


Hi,

I'm having some difficulties testing a module that uses persistent  
classes.
In that case the classes aren't loaded from a jar but are directly  
in the

classpath and so does the persistence.xml.  However I always get No
Persistence provider for EntityManager named ode-store. I've tried  
several

things:

- placing persistence.xml in a META-INF subdirectory of a directory  
directly

in my classpath
- placing persistence.xml in a directory directly in my classpath
- renaming my persistence.xml to openjpa.xml and placing its directory
directly in my classpath
- setting the openjpa.properties system property to the location of  
the

openjpa.xml

None of these worked, same error message. I guess I'm missing  
something but

can't spot what, any idea?

Thanks!
Matthieu




Re: Testing an OpenJPA module

2007-04-09 Thread Matthieu Riou

The System.out gives me the correct path to the URL:

file:/home/dusty/Dev/Projects/ode/bpel-store/target/classes/META-INF/persistence.xml

The corresponding file contains:

persistence xmlns=http://java.sun.com/xml/ns/persistence;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   version=1.0
   persistence-unit name=ode-store
   providerorg.apache.openjpa.persistence.PersistenceProviderImpl
/provider
   classorg.apache.ode.store.jpa.ProcessConfDaoImpl/class
   classorg.apache.ode.store.jpa.ProcessConfPropertyDaoImpl/class
   classorg.apache.ode.store.jpa.DeploymentUnitDaoImpl/class
   classorg.apache.ode.store.jpa.VersionTrackerDAOImpl/class
   /persistence-unit
/persistence

Thanks,
Matthieu

On 4/9/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Matthieu-

Note that there shouldn't be any problem with running against a
directory versus a jar (I do it all the time), so there is probably
some environment issue.

Can you post your persistence.xml? If you write a little main()
method that just does: System.out.println(getClass().getResource(/
META-INF/persistence.xml), what does it show?



On Apr 9, 2007, at 11:54 AM, Matthieu Riou wrote:

 Hi,

 I'm having some difficulties testing a module that uses persistent
 classes.
 In that case the classes aren't loaded from a jar but are directly
 in the
 classpath and so does the persistence.xml.  However I always get No
 Persistence provider for EntityManager named ode-store. I've tried
 several
 things:

 - placing persistence.xml in a META-INF subdirectory of a directory
 directly
 in my classpath
 - placing persistence.xml in a directory directly in my classpath
 - renaming my persistence.xml to openjpa.xml and placing its directory
 directly in my classpath
 - setting the openjpa.properties system property to the location of
 the
 openjpa.xml

 None of these worked, same error message. I guess I'm missing
 something but
 can't spot what, any idea?

 Thanks!
 Matthieu




Re: Testing an OpenJPA module

2007-04-09 Thread Marc Prud'hommeaux

Matthieu-

Hmm ... the persistence.xml file is fine (I just tried it locally). I  
think the error No Persistence provider for EntityManager named ode- 
store is coming from javax.persistence.Persistence not being able to  
load org.apache.openjpa.persistence.PersistenceProviderImpl.


Are you sure the OpenJPA jar (and all its required dependencies) are  
in your CLASSPATH? Can you send us the setting of your classpath?


If you write a main() method that just tries new  
org.apache.openjpa.persistence.PersistenceProviderImpl(), what happens?




On Apr 9, 2007, at 12:25 PM, Matthieu Riou wrote:


The System.out gives me the correct path to the URL:

file:/home/dusty/Dev/Projects/ode/bpel-store/target/classes/META- 
INF/persistence.xml


The corresponding file contains:

persistence xmlns=http://java.sun.com/xml/ns/persistence;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   version=1.0
   persistence-unit name=ode-store

providerorg.apache.openjpa.persistence.PersistenceProviderImpl

/provider
   classorg.apache.ode.store.jpa.ProcessConfDaoImpl/class
   classorg.apache.ode.store.jpa.ProcessConfPropertyDaoImpl/ 
class

   classorg.apache.ode.store.jpa.DeploymentUnitDaoImpl/class
   classorg.apache.ode.store.jpa.VersionTrackerDAOImpl/class
   /persistence-unit
/persistence

Thanks,
Matthieu

On 4/9/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Matthieu-

Note that there shouldn't be any problem with running against a
directory versus a jar (I do it all the time), so there is probably
some environment issue.

Can you post your persistence.xml? If you write a little main()
method that just does: System.out.println(getClass().getResource(/
META-INF/persistence.xml), what does it show?



On Apr 9, 2007, at 11:54 AM, Matthieu Riou wrote:

 Hi,

 I'm having some difficulties testing a module that uses persistent
 classes.
 In that case the classes aren't loaded from a jar but are directly
 in the
 classpath and so does the persistence.xml.  However I always get  
No

 Persistence provider for EntityManager named ode-store. I've tried
 several
 things:

 - placing persistence.xml in a META-INF subdirectory of a directory
 directly
 in my classpath
 - placing persistence.xml in a directory directly in my classpath
 - renaming my persistence.xml to openjpa.xml and placing its  
directory

 directly in my classpath
 - setting the openjpa.properties system property to the location of
 the
 openjpa.xml

 None of these worked, same error message. I guess I'm missing
 something but
 can't spot what, any idea?

 Thanks!
 Matthieu






Re: Testing an OpenJPA module

2007-04-09 Thread Matthieu Riou

I thought I had OpenJPA correctly placed but actually it wasn't copied at
the right place. Thanks for the hint!

Matthieu

On 4/9/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:


Matthieu-

Hmm ... the persistence.xml file is fine (I just tried it locally). I
think the error No Persistence provider for EntityManager named ode-
store is coming from javax.persistence.Persistence not being able to
load org.apache.openjpa.persistence.PersistenceProviderImpl.

Are you sure the OpenJPA jar (and all its required dependencies) are
in your CLASSPATH? Can you send us the setting of your classpath?

If you write a main() method that just tries new
org.apache.openjpa.persistence.PersistenceProviderImpl(), what happens?



On Apr 9, 2007, at 12:25 PM, Matthieu Riou wrote:

 The System.out gives me the correct path to the URL:

 file:/home/dusty/Dev/Projects/ode/bpel-store/target/classes/META-
 INF/persistence.xml

 The corresponding file contains:

 persistence xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
version=1.0
persistence-unit name=ode-store

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl
 /provider
classorg.apache.ode.store.jpa.ProcessConfDaoImpl/class
classorg.apache.ode.store.jpa.ProcessConfPropertyDaoImpl/
 class
classorg.apache.ode.store.jpa.DeploymentUnitDaoImpl/class
classorg.apache.ode.store.jpa.VersionTrackerDAOImpl/class
/persistence-unit
 /persistence

 Thanks,
 Matthieu

 On 4/9/07, Marc Prud'hommeaux [EMAIL PROTECTED] wrote:

 Matthieu-

 Note that there shouldn't be any problem with running against a
 directory versus a jar (I do it all the time), so there is probably
 some environment issue.

 Can you post your persistence.xml? If you write a little main()
 method that just does: System.out.println(getClass().getResource(/
 META-INF/persistence.xml), what does it show?



 On Apr 9, 2007, at 11:54 AM, Matthieu Riou wrote:

  Hi,
 
  I'm having some difficulties testing a module that uses persistent
  classes.
  In that case the classes aren't loaded from a jar but are directly
  in the
  classpath and so does the persistence.xml.  However I always get
 No
  Persistence provider for EntityManager named ode-store. I've tried
  several
  things:
 
  - placing persistence.xml in a META-INF subdirectory of a directory
  directly
  in my classpath
  - placing persistence.xml in a directory directly in my classpath
  - renaming my persistence.xml to openjpa.xml and placing its
 directory
  directly in my classpath
  - setting the openjpa.properties system property to the location of
  the
  openjpa.xml
 
  None of these worked, same error message. I guess I'm missing
  something but
  can't spot what, any idea?
 
  Thanks!
  Matthieu