These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: tomcat5.5+hibernate3.1.3,help needed, thanks
PostPosted: Sun Jul 22, 2007 9:00 pm 
Newbie

Joined: Sun Jul 22, 2007 8:52 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hello,
I got the following message when call a servlet using Tomcat container. Would somebody give me a help to find where is wrong
and how to fix it. Thanks in advance. ---FH


Hibernate version:3.1.3



Full stack trace of any exception that occurs:
exception
javax.servlet.ServletException: Error instantiating servlet class javamxj.hibernate.Hb2test
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: org/hibernate/Session
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
java.lang.Class.getConstructor0(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)



Name and version of the database you are using:MySQL



My servlet Hb2test.java at web/inf/src:

package javatest.hibernate;

import org.hibernate.*;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class Hb2test extends HttpServlet {

public void init() throws ServletException {

}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
doPost(request, response);
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {


try {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session session = sf.openSession(); session.beginTransaction();
User user = new User();
user.setUsername("Blog");
user.setPassword("test");
session.save(user);
session.getTransaction().commit();
session.close();

} catch (Exception e) {
e.printStackTrace();
}

}
}

web.xml at web-inf:

<servlet>
<servlet-name>Hb2test</servlet-name>
<servlet-class>javatest.hibernate.Hb2test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hb2test</servlet-name>
<url-pattern>/hb2test</url-pattern>
</servlet-mapping>



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.