Hello,
Does anybody had the following problem ?
I was trying to run my application in openejb (tomcat 5.5, openejb 3.0
war, java 1.5, hibernate 3), but it is showing an error when I call,
new Configuration().setInterceptor(new MyHibernateInterceptor())
.configure("my-hibernate.cfg.xml").buildSessionFactory();
The error log is,
INFO - Creating subcontext: hibernate
WARN - Could not bind factory to JNDI
javax.naming.OperationNotSupportedException
at
org.apache.openejb.core.ivm.naming.IvmContext.rebind(IvmContext.java:283)
at
org.apache.openejb.core.ivm.naming.IvmContext.rebind(IvmContext.java:287)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:74)
at
org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
My "my-hibernate.cfg.xml" will looklike as follows.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="module1/hibernate/HibernateFactory">
<property name="show_sql">true</property>
<property name="connection.datasource">java:comp/env/MySQLDS</property>
<property
name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property
name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property
name="transaction.manager_lookup_class">org.apache.openejb.hibernate.TransactionManagerLookup</property>
<property name="connection.release_mode">auto</property>
<property name="transaction.flush_before_completion">true</property>
<property name="transaction.auto_close_session">true</property>
<mapping resource="..." />
... all my mapping resources will come here ....
</session-factory>
</hibernate-configuration>
If anyone knows the solution to this issue, please help me. Thanks in
advance.
-Manoj.