Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Creating entity manager factory error
PostPosted: Sat Feb 18, 2017 5:30 pm 
Newbie

Joined: Fri Jan 13, 2017 4:16 pm
Posts: 6
Hello guys,
I just updated Mongo port to newest version 5.1.0.CR1 and in tests I get following error during creating of entity manager factory

Code line:
Code:
entityManagerFactory = Persistence.createEntityManagerFactory("DatabaseName");


Error stack:
Code:
java.lang.NoClassDefFoundError: javax/transaction/SystemException
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:348)
   at org.jboss.logging.Logger$1.run(Logger.java:2554)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516)
   at org.hibernate.jpa.internal.HEMLogging.messageLogger(HEMLogging.java:28)
   at org.hibernate.jpa.internal.HEMLogging.messageLogger(HEMLogging.java:24)
   at org.hibernate.jpa.boot.internal.PersistenceXmlParser.<clinit>(PersistenceXmlParser.java:55)
   at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:80)
   at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:71)
   at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:52)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
   at com.test.ProcessPlatformsTest.setUpEntityManagerFactory(ProcessPlatformsTest.java:32)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
   at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
   at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
   at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
   at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   ... 35 more


There is a quick fix by adding
Code:
javax.transaction:jta
to dependencies.

I'm not sure whether its a bug or not, so it would be great if somebody from devs reply as well :)

C.


Top
 Profile  
 
 Post subject: Re: Creating entity manager factory error
PostPosted: Mon Feb 20, 2017 5:07 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi, can you give us more details about the configuration?

Thanks,
Davide


Top
 Profile  
 
 Post subject: Re: Creating entity manager factory error
PostPosted: Mon Feb 20, 2017 8:52 pm 
Newbie

Joined: Fri Jan 13, 2017 4:16 pm
Posts: 6
Hi Davide, here's a configuration I do have for this project. Nothing special, just basic properties are set.

Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">

    <persistence-unit name="DatabaseName" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>

        <properties>
            <property name="hibernate.ogm.datastore.provider" value="mongodb" />
            <property name="hibernate.ogm.datastore.database" value="testDB" />
            <property name="hibernate.ogm.datastore.host" value="localhost" />
            <property name="hibernate.ogm.datastore.create_database" value="true" />
        </properties>
    </persistence-unit>
</persistence>


Top
 Profile  
 
 Post subject: Re: Creating entity manager factory error
PostPosted: Tue Feb 21, 2017 1:53 pm 
Beginner
Beginner

Joined: Thu Jan 05, 2017 1:47 pm
Posts: 27
I think I came across this before. I added the following to my build.gradle dependencies to fix it:

// Argh! dependency handling is not picking this up transitively through hibernate-core
compile 'org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1'

It turned out that hibernate core, somewhere in its dependency tree, was excluding the JTA implementation.


Top
 Profile  
 
 Post subject: Re: Creating entity manager factory error
PostPosted: Wed Feb 22, 2017 5:41 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
I think it make sense, most of the time the implementation is provided by the container you are running your application.

For standalone application you need to provide your implementation of choice.

I'll check the documentation about this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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.