[hibernate-dev] Exceptions while trying to use HibernateOGM

Babak Bastan babakbsn at gmail.com
Wed Aug 14 06:44:54 EDT 2013


I would not have using mailing list this unless I was truely frustrated. I
want to implement a very simple example using HibernateOGM but I get some
exceptions, which I don't know really how can to solve them.

in the main I have started with this lock of code:
            OgmConfiguration cfgogm=new OgmConfiguration();
            cfgogm.configure();
            serviceregistry=new
ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
            sessionfactory=cfgogm.buildSessionFactory(serviceregistry);

I can build my code successfully but if I run it  I get some exceptions:

Exception in thread "main" org.hibernate.service.spi.ServiceException:
Unable to create requested service
[org.hibernate.engine.transaction.spi.TransactionFactory]
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:180)
at
org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)
at hogm.hibernateogm_mongodb.App.main(App.java:33)
Caused by: org.hibernate.HibernateException: Unable to instantiate
specified TransactionFactory class [org.transaction.JDBCTransactionFactory]
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)
... 7 more
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException:
Unable to load class [org.transaction.JDBCTransactionFactory]
at
org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)
at
org.hibernate.engine.transaction.internal.TransactionFactoryInitiator.initiateService(TransactionFactoryInitiator.java:77)
... 12 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class
: org.transaction.JDBCTransactionFactory
at
org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at
org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)
... 13 more

If I do this line of code comment, I see no exceptions:

 sessionfactory=cfgogm.buildSessionFactory(serviceregistry);

it is my *hibernate.cfg.xml:*
*
*
*
<?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.o"></property>
    <property
name="hibernate.transaction.factory_class">org.transaction.JDBCTransactionFactory</property>
    <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>


*
could you please explain me, why I get this problem and how can I solve
this?


More information about the hibernate-dev mailing list