Re: NoClassDefFoundError in service after clicking a button

2010-06-26 Thread Ruben van Loen
Thanks! That worked

-- 
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-tool...@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.



NoClassDefFoundError in service after clicking a button

2010-06-25 Thread Ruben
Hi,

I am running in a NoClassDeffFoundError after clicking a button in my
very basic app. I modified the standard app in Eclipse just a little
bit by adding 1 service method:

1. Created a new GWT project in Eclipse. This gets me the standard
Greeting Service example app - app works
2. I created a User class, which is just a POJO - app works
3. Added a HibernateUtil class for access to Hibernate - app works
4. Added Hibernate JAR to the build path in Eclipse - app works
5. Modified the GreetingServiceImpl by importing
org.hibernate.session, HibernateUtil and User - app works
5. Added the following getUser method to the GreetingServiceImpl - app
breaks!

// Retrieves a user from Hibernate
public User getUser(int userId){
  Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
  session.beginTransaction();
  // Get the User from Hibernate
  User user = (User) session.get(User.class, userId);
  // TODO Translate user to a serializable data transfer object before
returning
  return new User();
}

Whenever I press the Send button in the Greeting Service app I get the
following stacktrace in the Eclipse console:

WARNING: Error for /test/greet
java.lang.NoClassDefFoundError: org/hibernate/Session
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)


Do  you know why this happens? The getUser() method that seems to be
responsible is not even called. And I imported the
org.hibernate.Session class and it's on the Eclipse build bath.


-- 
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-tool...@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: NoClassDefFoundError in service after clicking a button

2010-06-25 Thread Sripathi Krishnan
Disable Google App Engine in your eclipse settings, and remove all GAE jars
from your classpath.

GAE doesn't allow you to open socket connections, which is exactly what
hibernate is trying to do before it fails.

--Sri


On 26 June 2010 01:15, Ruben ruben...@gmail.com wrote:

 Hi,

 I am running in a NoClassDeffFoundError after clicking a button in my
 very basic app. I modified the standard app in Eclipse just a little
 bit by adding 1 service method:

 1. Created a new GWT project in Eclipse. This gets me the standard
 Greeting Service example app - app works
 2. I created a User class, which is just a POJO - app works
 3. Added a HibernateUtil class for access to Hibernate - app works
 4. Added Hibernate JAR to the build path in Eclipse - app works
 5. Modified the GreetingServiceImpl by importing
 org.hibernate.session, HibernateUtil and User - app works
 5. Added the following getUser method to the GreetingServiceImpl - app
 breaks!

 // Retrieves a user from Hibernate
 public User getUser(int userId){
  Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
  session.beginTransaction();
  // Get the User from Hibernate
  User user = (User) session.get(User.class, userId);
  // TODO Translate user to a serializable data transfer object before
 returning
  return new User();
 }

 Whenever I press the Send button in the Greeting Service app I get the
 following stacktrace in the Eclipse console:

 WARNING: Error for /test/greet
 java.lang.NoClassDefFoundError: org/hibernate/Session
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)


 Do  you know why this happens? The getUser() method that seems to be
 responsible is not even called. And I imported the
 org.hibernate.Session class and it's on the Eclipse build bath.


 --
 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-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
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-tool...@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.