Re: GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-11 Thread Yaakov

Well, I am using Toplink, not hibernate... I did finally figure out my
problem. Since Marco's blog is what helped point me in the right
direction, I posted the complete explanation there:

http://codetrips.blogspot.com/2009/05/gwt-spring-and-jpa-not-really-friendly.html

See the comments to that blog.

Thanks,
Yaakov.

P.S. I would disagree though that my post has nothing to do with GWT.
The whole thing started only because of how GWT Eclipse plugin is (is
not?) working. As you'll see from my comment to that blog, it's GWT
Eclipse plugin that was part of the problem.

On Nov 4, 1:16 pm, Davis Ford davisf...@zenoconsulting.biz wrote:
 This is from the spring page you linked:

 Not all JPA providers impose the need of a JVM agent (Hibernate being an
 example). If your provider does not require an agent or you have other
 alternatives (for example applying enhancements at build time through a
 custom compiler or an ant task) the load-time weaver *should not* be used.

 This really is more of a hibernate/spring/maven config issue.  Apologies to
 the list...

 Are you using JpaTemplate?  I have a blog post here that shows how to setup
 JPA with Hibernate/Spring:http://zenoconsulting.wikidot.com/blog:8-- you
 might find it helpful.  I don't use a load-time weaver.



 On Wed, Nov 4, 2009 at 10:32 AM, Yaakov yaakov.chai...@gmail.com wrote:

   to be honest, this sounds like it is not so much a gwt thing as it is a
   hibernate/spring thing.

  It IS a GWT thing in the sense that it is the Jetty server which the
  GWT Eclipse plugin starts up which refuses to recognize that I am
  starting its JVM with a -javaagent. Why it does that? I don't know...
  All I want to get to is being able to refresh the hosted browser after
  I make some change in the GWT code and see it in the hosted browser
  instantly.

   i've used hibernate/spring a lot with jpa, and never had to specify a
  weaver
   via an extra JVM argument.  it seems a bit odd.

  Well, I didn't make this up, really. Take a look at Spring
  documentation for 2.5.5:
 http://static.springsource.org/spring/docs/2.5.x/reference/orm.html#o...

  ALL 3 options mention weaving.

   i'm not trying to dodge the
   question, but typically i solve these issues with google searches.

  I haven't found anything wrt GWT provided servlet engine, i.e. jetty
  bundled with GWT. The only link I found, I provided, but that doesn't
  seem to work anyway.

  If anyone has any ideas, please suggest.

  Thanks,
  Yaakov.

 --
 Zeno Consulting, Inc.
 home:http://www.zenoconsulting.biz
 blog:http://zenoconsulting.wikidot.com
 p: 248.894.4922
 f: 313.884.2977
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-04 Thread Yaakov

So, when I do provide (as I wrote before) -javaagent:c:\\spring-
agent.jar, and I start up GWT hosted environment through Run in
eclipse, I get an exception like this:
Caused by: java.lang.IllegalStateException: ClassLoader
[com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload
$WebAppClassLoaderExtension] does NOT provide an 'addTransformer
(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or
start your Java virtual machine with Spring's agent: -javaagent:spring-
agent.jar

Not sure how to get around gwt jetty launcher's inability to accept a
load-time weaver.

Anyone?

Thanks,
Yaakov.

On Nov 4, 10:32 am, Yaakov yaakov.chai...@gmail.com wrote:
  to be honest, this sounds like it is not so much a gwt thing as it is a
  hibernate/spring thing.

 It IS a GWT thing in the sense that it is the Jetty server which the
 GWT Eclipse plugin starts up which refuses to recognize that I am
 starting its JVM with a -javaagent. Why it does that? I don't know...
 All I want to get to is being able to refresh the hosted browser after
 I make some change in the GWT code and see it in the hosted browser
 instantly.

  i've used hibernate/spring a lot with jpa, and never had to specify a weaver
  via an extra JVM argument.  it seems a bit odd.

 Well, I didn't make this up, really. Take a look at Spring
 documentation for 
 2.5.5:http://static.springsource.org/spring/docs/2.5.x/reference/orm.html#o...

 ALL 3 options mention weaving.

  i'm not trying to dodge the
  question, but typically i solve these issues with google searches.

 I haven't found anything wrt GWT provided servlet engine, i.e. jetty
 bundled with GWT. The only link I found, I provided, but that doesn't
 seem to work anyway.

 If anyone has any ideas, please suggest.

 Thanks,
 Yaakov.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-04 Thread Davis Ford
This is from the spring page you linked:

Not all JPA providers impose the need of a JVM agent (Hibernate being an
example). If your provider does not require an agent or you have other
alternatives (for example applying enhancements at build time through a
custom compiler or an ant task) the load-time weaver *should not* be used.

This really is more of a hibernate/spring/maven config issue.  Apologies to
the list...

Are you using JpaTemplate?  I have a blog post here that shows how to setup
JPA with Hibernate/Spring: http://zenoconsulting.wikidot.com/blog:8 -- you
might find it helpful.  I don't use a load-time weaver.

On Wed, Nov 4, 2009 at 10:32 AM, Yaakov yaakov.chai...@gmail.com wrote:


  to be honest, this sounds like it is not so much a gwt thing as it is a
  hibernate/spring thing.

 It IS a GWT thing in the sense that it is the Jetty server which the
 GWT Eclipse plugin starts up which refuses to recognize that I am
 starting its JVM with a -javaagent. Why it does that? I don't know...
 All I want to get to is being able to refresh the hosted browser after
 I make some change in the GWT code and see it in the hosted browser
 instantly.

  i've used hibernate/spring a lot with jpa, and never had to specify a
 weaver
  via an extra JVM argument.  it seems a bit odd.

 Well, I didn't make this up, really. Take a look at Spring
 documentation for 2.5.5:
 http://static.springsource.org/spring/docs/2.5.x/reference/orm.html#orm-jpa

 ALL 3 options mention weaving.

  i'm not trying to dodge the
  question, but typically i solve these issues with google searches.

 I haven't found anything wrt GWT provided servlet engine, i.e. jetty
 bundled with GWT. The only link I found, I provided, but that doesn't
 seem to work anyway.

 If anyone has any ideas, please suggest.

 Thanks,
 Yaakov.
 



-- 
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977

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



Re: GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-03 Thread Yaakov

Thanks for point that out... Now, it does pick up the persistence
unit...

However, I am still not able to start up pre-bundled with Eclipse GWT
Jetty server.

First, it complained that I didn't specify a persistence provider. I
did that by changing my entityManagerFactory to this:

bean id=entityManagerFactory
 
class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
   property name=persistenceUnitName value=testUnit
   property name=jpaDialect
value=org.springframework.orm.jpa.vendor.TopLinkJpaDialect /
   property name=jpaVendorAdapter
value=org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter /
 /bean

After I did this, it started complaining that I Cannot apply class
transformer without LoadTimeWeaver specified.

Well, I tried specifying the load time weaver:
bean id=entityManagerFactory
 
class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
   property name=loadTimeWeaver
  bean
class=org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
 /

   /property
   property name=persistenceUnitName value=testUnit
   property name=jpaDialect
value=org.springframework.orm.jpa.vendor.TopLinkJpaDialect /
   property name=jpaVendorAdapter
value=org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter /
 /bean


When I specify that, it complains that in order to use that particular
weaver, I need to start with a Java agent... From Spring
documentation, that would be spring-agent-2.5.5.jar...

I opened Run Configurations in Eclipse and chose my GWT web app run
configuration. Then, I switched to the Arguments tab and put this in
VM arguments:
-javaagent:c:\spring-agent-2.5.5.jar

This is the exact same configuration (in my spring config and in my
run configuration) that I use to run JPA DAO tests without requiring a
server and it runs just fine within Eclipse and within maven...

However, even after specifying the Java agent the way I just
described, I still get the same error... It's as if GWT Hosted mode
server doesn't see that I am asking it to start with a specific Java
agent (specified in the Arguments-vm arguments in Eclipse)...

Any ideas as to how to get this to work?

Thanks,
Yaakov.



On Nov 3, 3:33 pm, Davis Ford davisf...@zenoconsulting.biz wrote:
 don't put persistence.xml in war folder, put it here:

 ${basedir}/src/main/resources/META-INF/persistence.xml

 When you build, maven will make sure it goes in the classes dir of your
 webapp (i.e. app.war!/WEB-INF/classes/persistence.xml)

 On Tue, Nov 3, 2009 at 3:03 PM, Yaakov Chaikin 
 yaakov.chai...@gmail.comwrote:





  Hi,

  I am trying to get hosted mode to work in Eclipse 3.4 with GWT plugin
  1.7 on Windows...

  Here is what I have:

  1) Maven folder structure, as I use maven to compile/deploy the whole
  thing.
  2) 3 separate modules (eclipse projects): Persistence, Model, and Web
  (this is the GWT project).
  3) Model has JPA annotated POJOs
  4) Persistence has Spring annotated DAOs like this:
  @Service
  @Transactional
  public UserDAOImpl implements UserDAO
  {
    @PersistenceContext(unitName=testUnit)
    private EntityManager manager;

    public User getUser(String userName)
    {
       // some JPA code
    }
  }

  5) The Persistence module has persistence.xml in
  src/main/resource/META-INF which looks like this:
   standard header stuff...
   persistence-unit name=testUnit transaction-type=RESOURCE_LOCAL
      classtest.User/class
      properties
         property name=toplink.jdbc.driver
  value=oracle.jdbc.driver.OracleDriver /
         property name=toplink.jdbc.url  value=oracle URL /
         property name=toplink.jdbc.user value=user /
        property name=toplink.jdbc.password value=password /
    /properties
  /persistence-unit

  6) In my Web module, I load this Spring configuration:

  ... standard header stuff
   bean id=entityManagerFactory
           class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
    property name=persistenceUnitName value=testUnit
   /bean
   .
   there are other things defined here
   .

  I think it is #6 where things are getting stuck... When I try to start
  Eclipse GWT in Hosted mode, the console spits out error creating bean
  with name 'entityManagerFactory' defined in class path resource
  test-context.xml: Invocation of init method failed; nested exception
  is java.lang.IllegalArgumentException: No persistence unit with name
  'testUnit' found

  I have no idea why this is happening... I already tried to create a
  directory under my 'war' directory in the Web module called META-INF
  and place the persistence.xml there, but it still says it can't find
  the persistence unit with name 'testUnit'...

  My maven dependencies bring the following into classpath (besides the
  other 2 modules this one depends on and besides the usual gwt ones):
  dependency
   groupIdjava.persistence/groupId
   artifactIdpersistence-api/artifactId
   version1.0/version
  /dependency
  dependency
   groupIdoracle/groupId
   

Re: GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-03 Thread Davis Ford
which maven gwt plugin are you using -- is it the  codehaus gwt plugin?

to be honest, this sounds like it is not so much a gwt thing as it is a
hibernate/spring thing.

i've used hibernate/spring a lot with jpa, and never had to specify a weaver
via an extra JVM argument.  it seems a bit odd.  i'm not trying to dodge the
question, but typically i solve these issues with google searches.
 something in your project setup is not right -- narrow it down.

On Tue, Nov 3, 2009 at 4:57 PM, Yaakov yaakov.chai...@gmail.com wrote:


 Thanks for point that out... Now, it does pick up the persistence
 unit...

 However, I am still not able to start up pre-bundled with Eclipse GWT
 Jetty server.

 First, it complained that I didn't specify a persistence provider. I
 did that by changing my entityManagerFactory to this:

 bean id=entityManagerFactory

 class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
   property name=persistenceUnitName value=testUnit
property name=jpaDialect
 value=org.springframework.orm.jpa.vendor.TopLinkJpaDialect /
   property name=jpaVendorAdapter
 value=org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter /
  /bean

 After I did this, it started complaining that I Cannot apply class
 transformer without LoadTimeWeaver specified.

 Well, I tried specifying the load time weaver:
 bean id=entityManagerFactory

 class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
property name=loadTimeWeaver
  bean
 class=org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
 /
 
   /property
property name=persistenceUnitName value=testUnit
property name=jpaDialect
 value=org.springframework.orm.jpa.vendor.TopLinkJpaDialect /
   property name=jpaVendorAdapter
 value=org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter /
  /bean


 When I specify that, it complains that in order to use that particular
 weaver, I need to start with a Java agent... From Spring
 documentation, that would be spring-agent-2.5.5.jar...

 I opened Run Configurations in Eclipse and chose my GWT web app run
 configuration. Then, I switched to the Arguments tab and put this in
 VM arguments:
 -javaagent:c:\spring-agent-2.5.5.jar

 This is the exact same configuration (in my spring config and in my
 run configuration) that I use to run JPA DAO tests without requiring a
 server and it runs just fine within Eclipse and within maven...

 However, even after specifying the Java agent the way I just
 described, I still get the same error... It's as if GWT Hosted mode
 server doesn't see that I am asking it to start with a specific Java
 agent (specified in the Arguments-vm arguments in Eclipse)...

 Any ideas as to how to get this to work?

 Thanks,
 Yaakov.



 On Nov 3, 3:33 pm, Davis Ford davisf...@zenoconsulting.biz wrote:
  don't put persistence.xml in war folder, put it here:
 
  ${basedir}/src/main/resources/META-INF/persistence.xml
 
  When you build, maven will make sure it goes in the classes dir of your
  webapp (i.e. app.war!/WEB-INF/classes/persistence.xml)
 
  On Tue, Nov 3, 2009 at 3:03 PM, Yaakov Chaikin yaakov.chai...@gmail.com
 wrote:
 
 
 
 
 
   Hi,
 
   I am trying to get hosted mode to work in Eclipse 3.4 with GWT plugin
   1.7 on Windows...
 
   Here is what I have:
 
   1) Maven folder structure, as I use maven to compile/deploy the whole
   thing.
   2) 3 separate modules (eclipse projects): Persistence, Model, and Web
   (this is the GWT project).
   3) Model has JPA annotated POJOs
   4) Persistence has Spring annotated DAOs like this:
   @Service
   @Transactional
   public UserDAOImpl implements UserDAO
   {
 @PersistenceContext(unitName=testUnit)
 private EntityManager manager;
 
 public User getUser(String userName)
 {
// some JPA code
 }
   }
 
   5) The Persistence module has persistence.xml in
   src/main/resource/META-INF which looks like this:
    standard header stuff...
persistence-unit name=testUnit transaction-type=RESOURCE_LOCAL
   classtest.User/class
   properties
  property name=toplink.jdbc.driver
   value=oracle.jdbc.driver.OracleDriver /
  property name=toplink.jdbc.url  value=oracle URL /
  property name=toplink.jdbc.user value=user /
 property name=toplink.jdbc.password value=password /
 /properties
   /persistence-unit
 
   6) In my Web module, I load this Spring configuration:
 
   ... standard header stuff
bean id=entityManagerFactory
  
  class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
 property name=persistenceUnitName value=testUnit
/bean
.
there are other things defined here
.
 
   I think it is #6 where things are getting stuck... When I try to start
   Eclipse GWT in Hosted mode, the console spits out error creating bean
   with name 'entityManagerFactory' defined in class path resource
   test-context.xml: Invocation of init method failed; nested exception
   is 

GWT 1.7 + Eclipse, JPA, Spring configuration

2009-11-03 Thread Yaakov Chaikin

Hi,

I am trying to get hosted mode to work in Eclipse 3.4 with GWT plugin
1.7 on Windows...

Here is what I have:

1) Maven folder structure, as I use maven to compile/deploy the whole thing.
2) 3 separate modules (eclipse projects): Persistence, Model, and Web
(this is the GWT project).
3) Model has JPA annotated POJOs
4) Persistence has Spring annotated DAOs like this:
@Service
@Transactional
public UserDAOImpl implements UserDAO
{
   @PersistenceContext(unitName=testUnit)
   private EntityManager manager;

   public User getUser(String userName)
   {
  // some JPA code
   }
}

5) The Persistence module has persistence.xml in
src/main/resource/META-INF which looks like this:
 standard header stuff...
  persistence-unit name=testUnit transaction-type=RESOURCE_LOCAL
 classtest.User/class
 properties
property name=toplink.jdbc.driver
value=oracle.jdbc.driver.OracleDriver /
property name=toplink.jdbc.url  value=oracle URL /
property name=toplink.jdbc.user value=user /
   property name=toplink.jdbc.password value=password /
   /properties
/persistence-unit

6) In my Web module, I load this Spring configuration:

... standard header stuff
  bean id=entityManagerFactory
  class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
   property name=persistenceUnitName value=testUnit
 /bean
 .
 there are other things defined here
 .


I think it is #6 where things are getting stuck... When I try to start
Eclipse GWT in Hosted mode, the console spits out error creating bean
with name 'entityManagerFactory' defined in class path resource
test-context.xml: Invocation of init method failed; nested exception
is java.lang.IllegalArgumentException: No persistence unit with name
'testUnit' found

I have no idea why this is happening... I already tried to create a
directory under my 'war' directory in the Web module called META-INF
and place the persistence.xml there, but it still says it can't find
the persistence unit with name 'testUnit'...

My maven dependencies bring the following into classpath (besides the
other 2 modules this one depends on and besides the usual gwt ones):
dependency
  groupIdjava.persistence/groupId
  artifactIdpersistence-api/artifactId
  version1.0/version
/dependency
dependency
  groupIdoracle/groupId
  artifactIdjdbc/artifactId
  version1.4/version
/dependency
dependency
  groupIdoracle/groupId
  artifactIdoracle.toplink.essentials/artifactId
  version2.1-b60e-fcs/version
/dependency
dependency
  groupIdcommons-dbcp/groupId
  artifactIdcommons-dbcp/artifactId
  version1.2.2/version
/dependency

Obviously, there is more, but the bottom line is, for some reason, it
refuses to recognize my persistence unit... This is very frustrating
as I can't imagine having to redeploy every time I need to make GUI
update... One of the biggest points of GWT basically is out the
window.

I tried following what this blog pointed out (which is basically what
I've described above, but still have the same issues):
http://codetrips.blogspot.com/2009/05/gwt-spring-and-jpa-not-really-friendly.html

I can't imagine no one has used GWT with Spring and JPA and I am the
first one, so whoever knows the magic solution for this, please help
me out. I'd really appreciate it.

Thanks,
Yaakov.

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