I read through Java Persistence API spec and finally was able to make
a resource-local entity manager work.  persistence.xml went to WEB-INF/
classes/META-INF.

I'd like to able to use a container-managed entity manager through
injection, but I'm not sure if it is possible at all using a plain web
container (Jetty).  It looks as if I need to add some sort of an EE
container on top of Jetty, but I'm not sure where to start from.  My
persistence unit already uses JTA-aware data source
(com.atomikos.jdbc.AtomikosDataSourceBean +
org.postgresql.xa.PGXADataSource), but when I try to use
@PersistenceContext or @PersistenceUnit, injection does not happen.  I
would really appreciate it if someone could please help me understand
where I should look next.

Thanks in advance!
Yuri

On Sep 30, 11:52 pm, Y2i <[email protected]> wrote:
> persistence.xml has <persistence-unit name="Domain">.
> I tried @PersistenceContext, @PersistenceUnit and
> Persistence.createEntityManagerFactory() without any result.
> The problem is it does not matter what I type in persistence.xml,
> jetty does not see the file.
> I'm doing something fundamentally wrong, I'll try this again tomorrow
> with a fresh head.
> Thanks for sticking with me!
>
> On Sep 30, 11:33 pm, lineman78 <[email protected]> wrote:
>
>
>
> > Does your persistence.xml have the following:
>
> >  <persistence-unit name="Domain">
>
> > and using the following in your session bean:
>
> > @PersistenceContext(unitName="Domain")
> >   EntityManager em;
>
> > On Sep 30, 11:08 pm, Y2i <[email protected]> wrote:
>
> > > Thanks for the reply.  I'm doing something wrong because I'm getting
> > > the same error even when I place persistence.xml to /war/META-INF.
> > > javax.persistence.PersistenceException: No Persistence provider for
> > > EntityManager named Domain
>
> > > The exception is thrown in both hosted and stand-alone mode.  I'll try
> > > to configure JTA transactions first before doing anything else with
> > > the JPA.
>
> > > On Sep 30, 6:15 pm, lineman78 <[email protected]> wrote:
>
> > > > persistence.xml should be located in /war/META-INF
>
> > > > On Sep 30, 4:28 pm, Y2i <[email protected]> wrote:
>
> > > > > Client's requests go the server through RequestFactoryServlet.
> > > > > My service objects (those annotated with
> > > > > @Service(SomeDomainClass.class) on the client side are being called
> > > > > fine.
> > > > > When a service method explicitly creates an entity and returns it to
> > > > > the client, the request returns without problems.
>
> > > > > The problem occurs as soon as I start using JPA
> > > > > I use EclipseLink 2.1.0.  The transaction type is Resource Local for
> > > > > now
>
> > > > > When I try to eject EntityManager using @PersistenceContext, it is
> > > > > always null.
> > > > > When I try to get the factory using
> > > > > Persistence.createEntityManagerFactory("Domain"), the call would throw
> > > > > javax.persistence.PersistenceException: No Persistence provider for
> > > > > EntityManager named Domain
>
> > > > > It seems that nether GWT hosted server nor deployment server
> > > > > (jetty-6.1.23, same as hosted server) see persistence.xml file.  It
> > > > > does not matter what I type inside persistence.xml - the error is the
> > > > > same, as though it is not picked up by the server at all.
>
> > > > > Any help, especially where to place persistance.xml for a GWT project,
> > > > > would be greatly appreciated.  Thanks in advance.
> > > > > Yuri

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to