-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Unable to instantiate specified TransactionFactory class
PostPosted: Wed Aug 14, 2013 6:04 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
I have a problem. I am new in hibernate and I want to write a very simple example with HibernateOGM. I get an Exception that says:

Caused by: org.hibernate.HibernateException: Unable to instantiate specified TransactionFactory class [org.transaction.JDBCTransactionFactory]

I have searched really alot, but I couldn't find any solution for my problem. As I understand, the problem occures in this line:

Code:
sessionfactory=cfgogm.buildSessionFactory(serviceregistry);


If I comment the other lines I have no exception, only INFOS.

this is my Stacktrace:

Code:
at org.hibernate.engine.transaction.internal.TransactionFactoryInitiator.initiateService(TransactionFactoryInitiator.java:80)
    at org.hibernate.ogm.transaction.impl.OgmTransactionFactoryInitiator.buildServiceInstance(OgmTransactionFactoryInitiator.java:61)
    at org.hibernate.ogm.transaction.impl.OgmTransactionFactoryInitiator.buildServiceInstance(OgmTransactionFactoryInitiator.java:41)
    at org.hibernate.ogm.service.impl.OptionalServiceInitiator.initiateService(OptionalServiceInitiator.java:37)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176)

here you can find my code and hibernate.cfg.xml and pom.xml:

Code:
OgmConfiguration cfgogm=new OgmConfiguration();
            cfgogm.configure("hibernate.cfg.xml");
            serviceregistry=new ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
            sessionfactory=cfgogm.buildSessionFactory(serviceregistry)

hibernate.cfg.xml is:

Code:
<?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>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.ogm.datastore.grid_dialect">org.hibernate.ogm.dialect.mongodb.MongoDBDialect</property>
    <property name="hibernate.ogm.datastore.provider">mongodb</property>
    <property name="hibernate.ogm.mongodb.database">rcfdb</property>
    <property name="hibernate.ogm.mongodb.host">127.0.0.1</property>
    <property name="hibernate.ogm.mongodb.port">27017</property>
    <mapping resource="hibernate-contact.hbm.xml"/>
  </session-factory>
</hibernate-configuration>


pom.xml:

Code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>hogm</groupId>
  <artifactId>HibernateOGM_MongoDB</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>HibernateOGM_MongoDB</name>
  <url>http://maven.apache.org</url>
  <build>
          <plugins>
              <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <version>1.2.1</version>
                  <executions>
                      <execution>
                          <goals>
                                  <goal>exec</goal>
                          </goals>
                      </execution>
                  </executions>
              </plugin>
          </plugins>
  </build>

<dependencies>
     <dependency>
         <groupId>org.hibernate.ogm</groupId>
         <artifactId>hibernate-ogm-mongodb</artifactId>
         <version>4.0.0.Beta1</version>
     </dependency>
     <dependency>
         <groupId>org.hibernate.ogm</groupId>
         <artifactId>hibernate-ogm-core</artifactId>
         <version>4.0.0.Beta2</version>
     </dependency>   

  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.11</version>
   <scope>test</scope>
   <type>jar</type>
  </dependency>
</dependencies>
</project>


could you please help me to solve this problem?


Top
 Profile  
 
 Post subject: Re: Unable to instantiate specified TransactionFactory class
PostPosted: Wed Aug 14, 2013 11:01 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
I found it. I shoul only put:

Code:
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>


in my hibernate.cfg.xml file


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.