Thanks for your response Jin!

I am going to move to EE container.  Haven't decided yet which one,
currently I am looking at Spring.  I do like the fact that GWT team
works closely with SpringRoo team, which is a good sign.  I also like
how Roo leverages AspectJ to generate a lot of boilerplate code.  What
keeps me from going with Roo full speed is not everything I tried with
Roo is integrated with GWT in their 2.5.0.M3 release.  Another thing
is Roo seems to add many jars into my WEB-INF/lib, which will probably
make the startup slower and which I may not need.  Even STS studio
startup time is much longer than the one of Eclipse's, but it's a
different story.  Anyway, I'll continue to investigate this, with
primary focus on debugging without GWT re-compilation.

Thanks again,
Yuri

On Oct 6, 6:40 pm, Jin <[email protected]> wrote:
> Hi Yuri,
>
> That does sound painful!
>
> I would recommend using an EE container with a proper JPA
> implementation.  I guess the first thing when moving to an EE
> container is to understand a bit about that platform.  you can find
> out more about glassfish athttps://glassfish.dev.java.net/.
>
> I've been using JPA rather than Hibernate and I've been using JTA
> transactions (rather than resource local) so I don't need to
> explicitly specify the start and end of transactions (however, it also
> means that I CANNOT specify the start and end of transactions manually
> - I have to go by the JTA conventions).  I had to use JTA because I
> was using generated EJB's in another part of the backend and these
> were designed to use JTA.
>
> You can keep using development mode even with the EE container (took
> me a while to figure that out!), but your IDE probably won't be able
> to figure out the URL on it's own.  It's not too difficult tho - just
> append "?gwt.codesvr=127.0.0.1:9997" to the EE container URL (so
> assuming your server URL is "localhost:8080/Application", the full URL
> might be something like "localhost:8080/Application?
> gwt.codesvr=127.0.0.1:9997").
>
> However, GWT development mode does not affect the backend code of
> course, so whenever you need to update the back-end, you must do a
> build - not so bad for the back-end because only the relevant parts
> will be recompiled, however, it will rebuild your entire GWT app.
>
> So not ideal, but works reasonably well.  There is probably a way to
> get not to recompile the GWT stuff when other parts need to be
> rebuilt, but once in a while at least you should do a full clean and
> rebuild for your backend and the GWT bits will be recompiled too.
>
> btw, I haven't tried this in 2.1, but it works in 2.0.
>
> Cheers,
>
> Jin
>
> On 7 October 2010 11:41, Y2i <[email protected]> wrote:
> Hi Jin,
>
> I'm hitting one road block after another while using plain Jetty...
>
> javax.validation does not work saying that a default provider is not
> configured, even though I installed and put on a class path Hibernate
> validation framework.  And javax.validation works fine in a simple
> Java application.
>
> Another problem is marking methods as transactional.  I can use JPA in
> a resource-local mode, so I begin a transaction in an overridden
> servlet's doPost method and commit it at the end of the method, but I
> have to do this even when I don't need a transaction.
>
> Little things, but they are painful...
>
> I wanted to ask you for an advice on how to move to an EE container.
> When you use Glassfish, what does your development process look like?
> I'm mostly interested in debugging my client and server code without
> going through GWT compilation step.  Can you do that?  I would also
> appreciate any other advice.
>
> Thanks in advance,
> Yuri
>
> On Oct 5, 5:11 pm, Y2i <[email protected]> wrote:
>
>
>
> > Hi Jin,
>
> > Thank you for your response!
>
> > I was able to makeJPAwork in Jetty, but only using resource-local
> > entity manager in Java SE environement.  This makes sence because for
> > container-managed entity manager an EE environment is required, and
> > Jetty by itslef does not provide it.
>
> > My persistence unit uses JTA data source, but it probably does not
> > make sence to have it in SE environment, so I'll move back to a
> > regular data source.
>
> > Initially I tried to place my persistence unit in an application
> > client jar file.  When I used that jar file from a console
> > application, it worked fine.  But as soon as I linked it to my GWT
> > project, I ran into problems.  I use GWT 2.1's EntityRecord that is
> > annotated with @DataTransferObject(Entity.class), where the Entity
> > class sits in the persistence unit.  When I ran the application from
> > Eclipse, it would intermitently fail to load saying that Entity class
> > could not be found.  When I debugged the application from Eclipse, it
> > would always fail with the same error.  GWT compilation would also
> > fail similarly.   So I ended up placing the perisistence unit directly
> > into the GWT project, exactly as you did, and then the errors
> > disappeared.
>
> > My main question for you is can you debug your client and server code
> > without doing GWT compilation?  Debugging without GWT compilation is
> > the main thing that keeps me from moving from a plain Jetty to an
> > application server.
>
> > Thanks again for your resonse.
>
> > Yuri
>
> > On Oct 4, 7:08 pm, Jin <[email protected]> wrote:
>
> > > Hi Yuri,
>
> > > I went through similar issues trying to get GWT to work withJPA.
>
> > > I would imagine that Jetty does *not* supportJPA- I'm using
> > > Glassfish Enterprise Server with my GWT app for JEE /JPAsupport.
> > > Glassfish is open source and commercial support can be purchased if
> > > that's needed.
>
> > > I've been able to use injection using annotations (@PersistenceContext
> > > etc).
>
> > > My GWT and JEE code are in the same project - when I had them in
> > > separate projects I had problems getting them to talk.
>
> > > Have lots of battle scars from this one, so let me know if you have
> > > any other questions =)
>
> > > Cheers,
>
> > > Jin
>
> > > On Oct 4, 6:14 pm, Y2i <[email protected]> wrote:
>
> > > > 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
> > > > > > > theJPA.
>
> > > > > > > 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 usingJPA
> > > > > > > > > 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