-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate with MongoDB missing file
PostPosted: Sat Jul 12, 2014 7:49 am 
Newbie

Joined: Sat Jul 12, 2014 7:31 am
Posts: 6
I'm totally new in Hibernate. I'm trying to get entity/modify it. I'm using NetBeans.

I'm adjusting tutorial to my needs (http://docs.jboss.org/hibernate/ogm/4.0/reference/en-US/html/ogm-gettingstarted.html). After few days of war I got my application running but it generate error Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/util/xml/Origin. I understand that I need additional jar. I was looking for it as maen dependency still I can no find it.

I found this http://stackoverflow.com/questions/11951415/hibernate-entitymanager-4-classnotfound-exception. but clen and rebuild does not help.

Any ideas?

My POM.xml file:
<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>com.mycompany</groupId>
<artifactId>hibernate</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>hibernate</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.0.0.Beta4</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.1.0.GA</version>
</dependency>

<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<!-- optional -->

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-proxool</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-infinispan</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.3.5.Final</version>
</dependency>

<!-- standard APIs dependencies - provided in a Java EE container -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>

<!-- JBoss Transactions dependency -->

<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjta</artifactId>
<version>4.16.4.Final</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.2.1.ga</version>
<type>jar</type>
</dependency>

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

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>4.1.0.Final</version>
</dependency>

</dependencies>
</project>


full error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/util/xml/Origin
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at com.mycompany.hibernate.App.main(App.java:44)
Caused by: java.lang.ClassNotFoundException: org.hibernate.util.xml.Origin
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 4 more
------------------------------------------------------------------------
BUILD FAILURE


Top
 Profile  
 
 Post subject: Re: Hibernate with MongoDB missing file
PostPosted: Sun Jul 13, 2014 5:17 am 
Newbie

Joined: Sat Jul 12, 2014 7:31 am
Posts: 6
ok, I resolved given problem. Now I have other error:

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.getIdentifierGeneratorFactory()Lorg/hibernate/id/factory/spi/MutableIdentifierGeneratorFactory;
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1119)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:291)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:373)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:92)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at com.mycompany.hibernate.App.main(App.java:48)

any help?


Top
 Profile  
 
 Post subject: Re: Hibernate with MongoDB missing file
PostPosted: Sun Jul 13, 2014 8:38 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
the problems you are having are caused by mixing incompatible versions of the libraries.
All of hibernate-entitymanager, hibernate-infinispan, hibernate-ehcache, hibernate-proxool, hibernate-c3p0, hibernate-envers, hibernate-osgi, hibernate-annotations AND hibernate-core need to use the exact same version, always.

Only these three modules follow an independent versioning:
- org.hibernate.ogm:*
- hibernate-search
- hibernate-commons-annotations

To pick a compatible version of these extension modules, please look into the pom.xml of these projects to check if they are compatible with the Hibernate ORM version you picked for the first (longer) list.
Each of these is designed to be compatible to a specific version of Hibernate ORM, but in this case you should be able to ignore mismatches on the micro version.

So for example, both Hibernate Search version 4.5.0.Final and 4.5.1.Final are compatible with Hibernate core 4.3.0.Final, and also with 4.3.1.Final, 4.3.2.Final, 4.3.3.Final, 4.3.4.Final, 4.3.5.Final and also expected to work with 4.3.6.Final when this will be released.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.