PLEASE HELP! Tomcat and Hibernate ServletException, net/sf/cglib/core/KeyFactory problem

From: Tung Chau (tungchau81_at_yahoo.com)
Date: 08/20/04


Date: 19 Aug 2004 21:19:39 -0700

Hi,
I am newbie to Hibernate. I followed the instructions on the following
page to configure Tomcat to work with Hibernate.
http://www.hibernate.org/hib_docs/reference/en/html/quickstart.html
I tested hibernate with a simple Employee table and Employee.hbm.xml
===================================================================
My /src directory has
hibernate.cfg.xml at the root.
HibernateUtil.java inside package proj.db.
Employee.java inside package proj.mapping.
Employee.hbm.xml inside package proj.mapping.
==================================================================
The following code is put in test.jsp to test hibernate
"try{
Session s = HibernateUtil.currentSession();

Transaction tx= s.beginTransaction();

Employee E = new Employee();
E.setFirstName("blue");
E.setLastName("blue");
E.setEmail("blue@gmail.com");

s.save(E);
tx.commit();

HibernateUtil.closeSession();
}catch (Exception e) {
  out.println(e.getMessage());
}"
================================================
package proj.db;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

public class HibernateUtil {

    //private static Log log = LogFactory.getLog(HibernateUtil.class);

    private static final SessionFactory sessionFactory;

    static {
        try {
            // Create the SessionFactory
            Configuration conf= new Configuration()
            .addClass(elearning.mapping.Employee.class);
            //sessionFactory = new
Configuration().configure().buildSessionFactory();
            sessionFactory = conf.buildSessionFactory();
        } catch (Throwable ex) {
                System.out.println("HUHUHU");
                        System.out.println("******" + ex.getMessage());
            //log.error("Initial SessionFactory creation failed.",
ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static final ThreadLocal session = new ThreadLocal();

    public static Session currentSession() throws HibernateException {
        Session s = (Session) session.get();
        // Open a new Session, if this Thread has none yet
        if (s == null) {
            s = sessionFactory.openSession();
            session.set(s);
        }
        return s;
    }

    public static void closeSession() throws HibernateException {
        Session s = (Session) session.get();
        session.set(null);
        if (s != null)
            s.close();
    }
}
================================================================
========================================================
I got the following Servlet Exception
type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

org.apache.jasper.JasperException
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

............
root cause

javax.servlet.ServletException
        at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
        at org.apache.jsp.test_jsp._jspService(test_jsp.java:106)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

=======================================================
Here is part of the output in catalina.out:
"Aug 19, 2004 8:43:16 PM
net.sf.hibernate.transaction.TransactionManagerLookupFactory
getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use
of process level read-write cache is not recommended)
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.SettingsFactory
buildSettings
INFO: Use scrollable result sets: true
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.SettingsFactory
buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.SettingsFactory
buildSettings
INFO: Optimize cache for minimal puts: false
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.SettingsFactory
buildSettings
INFO: Query language substitutions: {}
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.SettingsFactory
buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
Aug 19, 2004 8:43:16 PM net.sf.hibernate.cfg.Configuration
configureCaches
INFO: instantiating and configuring caches
HUHUHU
******net/sf/cglib/core/KeyFactory
                                                                      
                                                                      
            Stopping service Tomcat-Standalone
Aug 19, 2004 8:43:03 PM org.apache.coyote.http11.Http11Protocol
destroy
INFO: Stoping http11 protocol on 8080
Catalina:type=ThreadPool,name=http8080"
==============================================================
I don't know what was going on.
What does the "net/sf/cglib/core/KeyFactory" message printed out above
mean?
Is there anything wrong with my configuration?
Thanks. I would appreciate any help.
Tung Chau



Relevant Pages

  • Need Help with Hibernate - "Not binding factory to JNDI, no JNDI name configured"
    ... I am experimenting wtih Hibernate and after working out all of the ... Security component's FFDC Diagnostic Module ... JAAS configuration information successfully pushed to login provider ... WebSphere Dynamic Cache initialized successfully. ...
    (comp.lang.java.databases)
  • Need Help with Hibernate - "Not binding factory to JNDI, no JNDI name configured"
    ... I am experimenting wtih Hibernate and after working out all of the ... Security component's FFDC Diagnostic Module ... JAAS configuration information successfully pushed to login provider ... WebSphere Dynamic Cache initialized successfully. ...
    (comp.lang.java.programmer)
  • Re: Write Caching vs. Safe Removal
    ... With the write cache enabled, there is a possibility that the ... On my desktop computers, ... On my laptop, I ... laptop to go into 'hibernate (something my desktop doesn't need to ...
    (microsoft.public.windowsxp.general)
  • Re: Slow computer
    ... Why is my computer slow in the morning after a night on standby. ... (Your computer can download that 16k picture faster than ... allowing pictures to be downloaded and stored in cache. ... extra hibernate button when you go to Shut Down. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Hibernate: how to retreive only few properties in a class
    ... Note the "getEmployeesSummaryList" and the return employee clause. ... I get a java.sql.SQLException: Column 'LoginName' not ... My guess is that Hibernate tries to map every column ... Hibernate to map only the columns found in the ResultSet? ...
    (comp.lang.java.databases)