Loading ...
Sorry, an error occurred while loading the content.

hibernate CMT Transaction Manager

Expand Messages
  • zarrefl@ymail.com
    Estou com problema para usar o hibernate por CMT e não consigo encontrar o motivo desse erro. Estou usando glassfish + hibernate 3.5.0, se alguém já tiver
    Message 1 of 1 , Dec 28, 2011
    • 0 Attachment
      Estou com problema para usar o hibernate por CMT e não consigo encontrar o motivo desse erro.

      Estou usando glassfish + hibernate 3.5.0, se alguém já tiver passado pelo mesmo problema.

      Quando é executado new Configuration().configure() recebo o erro:

      Caused by: org.hibernate.HibernateException: Could not locate TransactionManager
      at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:60)
      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:395)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
      at teste.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
      ... 49 more
      Caused by: javax.naming.NamingException: Lookup failed for 'java:/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: No object bound to name java:/TransactionManager]
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:57)
      ... 52 more
      Caused by: javax.naming.NameNotFoundException: No object bound to name java:/TransactionManager
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:772)
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:744)
      at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:180)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)
      ... 56 more


      Meu arquivo de configuração está da seguinte forma:


      <?xml version='1.0' encoding='utf-8'?>
      <!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

      <hibernate-configuration>

      <!-- a SessionFactory instance listed as /jndi/name -->
      <session-factory name="comp/env/hibernate/SessionFactory">

      <!-- sql dialect -->
      <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>

      <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>

      <!-- DataSource properties (begin) -->
      <property name="hibernate.connection.datasource">jdbc/PortalPool</property>
      <!-- DataSource properties (end) -->

      <!-- CMT transaction properties (begin) -->
      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
      <!-- CMT transaction properties (end) -->
      <property name="current_session_context_class">thread</property>

      <mapping resource="teste/hibernate/domain/AssinaturaEletronica.hbm.xml"/>

      </session-factory>

      </hibernate-configuration>
    Your message has been successfully submitted and would be delivered to recipients shortly.