I'm trying create a sample application using WebSphere V5.1 and Hibernate V 3.1. I've set up a datasource that connects to an Oracle Express 10g database. I've followed the instructions in
Thiis WebSphere Developer Tech Journal Article. When I try to initialize the Hibernate session factory, I get the following error:
[4/5/06 17:29:30:844 PDT] 33782bdf TransactionFa I org.hibernate.transaction.TransactionFactoryFactory Transaction strategy: org.hibernate.transaction.WebSphereTransactionManagerLookup
[4/5/06 17:29:30:844 PDT] 33782bdf WebSphereTran I org.hibernate.transaction.WebSphereTransactionManagerLookup WebSphere 5.1
[4/5/06 17:29:30:844 PDT] 33782bdf WebGroup I SRVE0181I: [HibernateSample] [/HibernateSample] [Servlet.LOG]: action: null: java.lang.ClassCastException: org.hibernate.transaction.WebSphereTransactionManagerLookup
at org.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:37)
at org.hibernate.cfg.SettingsFactory.createTransactionFactory(SettingsFactory.java:370)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:120)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at com.sample.util.HibernateStrutsPlugIn.init(HibernateStrutsPlugIn.java:40)
... more lines in stack trace
This error occurs on this line of code:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
here is my hibernate.cfg.xml file:
<hibernate-configuration>
<session-factory name="HybernateSessionFactory">
<property name="transaction.factory_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</property>
<property name="connection.datasource">jdbc/oracleXE</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hbm2ddl.auto">create</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>
<mapping resource="address.hbm.xml"/>
<mapping resource="phone.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Anyone have an idea why this class cast exception is occurring?
[ April 05, 2006: Message edited by: Merrill Higginson ]