NoClassDefFoundError in service after clicking a button

8 views
Skip to first unread message

Ruben

unread,
Jun 25, 2010, 3:45:50 PM6/25/10
to Google Web Toolkit
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.


Sripathi Krishnan

unread,
Jun 25, 2010, 5:39:03 PM6/25/10
to google-we...@googlegroups.com
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




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


Ruben van Loen

unread,
Jun 26, 2010, 12:28:05 PM6/26/10
to google-we...@googlegroups.com
Thanks! That worked

Reply all
Reply to author
Forward
0 new messages