I am learning Hibernate from the:
"Java Open Source Programming"
book and I have a handle on how Hibernate works but when doing their example, I get an error:
Code:
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.1
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: com/jwhitlock/ContactInfo.hbm.xml
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.jwhitlock.ContactInfo -> CONTACT
Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: /jndi/ContactsSessionFactory
Mar 29, 2004 11:41:20 AM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.HSQLDialect
Mar 29, 2004 11:41:21 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Mar 29, 2004 11:41:21 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 4
Mar 29, 2004 11:41:21 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:dbdata
Mar 29, 2004 11:41:21 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sa, password=}
Mar 29, 2004 11:41:21 AM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
Mar 29, 2004 11:41:21 AM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
Mar 29, 2004 11:41:24 AM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Mar 29, 2004 11:41:24 AM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Mar 29, 2004 11:41:24 AM net.sf.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:hsqldb:dbdata
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Mar 29, 2004 11:41:24 AM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.HSQLDialect
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: false
Mar 29, 2004 11:41:24 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Mar 29, 2004 11:41:24 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 4
Mar 29, 2004 11:41:24 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:dbdata
Mar 29, 2004 11:41:24 AM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sa, password=}
Mar 29, 2004 11:41:24 AM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
Mar 29, 2004 11:41:24 AM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Mar 29, 2004 11:41:24 AM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Mar 29, 2004 11:41:24 AM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Factory name: /jndi/ContactsSessionFactory
Mar 29, 2004 11:41:24 AM net.sf.hibernate.util.NamingHelper getInitialContext
INFO: JNDI InitialContext properties:{}
Mar 29, 2004 11:41:25 AM net.sf.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:hsqldb:dbdata
Mar 29, 2004 11:41:30 AM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
WARNING: Could not bind factory to JNDI
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at net.sf.hibernate.util.NamingHelper.bind(NamingHelper.java:59)
at net.sf.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:739)
at com.jwhitlock.Main.main(Main.java:23)
Hibernate: insert into CONTACT (FNAME, LNAME, PHONEAREACODE, PHONECOUNTRYCODE, PHONENUMBER, PK) values (?, ?, ?, ?, ?, ?)
Contact: com.jwhitlock.ContactInfo@97d026
I don't know how to remedy this. I had a problem before that where Hibernate couldn't find the initil context but that was fixed by adding j2ee.jar to the classpath. Anyone have any idea on what I'm doing wrong? I have code examples if needed. Thanks, Jeremy