-->
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: Getting NoSuchFieldsError
PostPosted: Wed Jun 10, 2015 8:09 am 
Newbie

Joined: Wed Jun 10, 2015 7:54 am
Posts: 3
Hi ,

When I am using mongo java driver version 3.0.2 with hibernate ogm jars instead of mongo-java-driver-2.13.1 which comes with the dist in the mongodb folder I am getting a NoSuchFieldsError

Persistence.xml

Code:
<persistence-unit name="mongodb-test" transaction-type="JTA">
        <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
        <properties>
            <property name="hibernate.ogm.datastore.provider" value="mongodb"></property>
            <property name="hibernate.ogm.datastore.host" value="192.168.0.237"></property>
            <property name="hibernate.ogm.datastore.create_database" value="true"></property>
            <property name="hibernate.ogm.datastore.database" value="anand_test"></property>
            <!--<property name="hibernate.ogm.mongodb.database" value=""></property>-->
            <!--<property name="hibernate.ogm.mongodb.username" value=""></property>-->
            <!--<property name="hibernate.ogm.mongodb.password" value=""></property>-->
            <property name="hibernate.ogm.mongodb.connection_timeout" value="5000"></property>
            <property name="hibernate.ogm.mongodb.authentication_mechanism" value="PLAIN"></property>
            <property name="hibernate.ogm.datastore.document.association_storage" value="IN_ENTITY"></property>
            <property name="hibernate.ogm.mongodb.association_document_storage" value="GLOBAL_COLLECTION"></property>
            <property name="hibernate.ogm.mongodb.write_concern" value="ACKNOWLEDGED"></property>
            <property name="hibernate.ogm.mongodb.read_preference" value="PRIMARY_PREFERRED"></property>
        </properties>
    </persistence-unit>


Person.java
Code:
import javax.persistence.Entity;
import javax.persistence.Id;
import org.bson.types.ObjectId;
import org.hibernate.annotations.Type;

/**
*
* @author anandmohan
*/
@Entity
public class Person {
    @Id
    @Type(type = "objectid")
    private String id;
   
    private String firstName;
    private String lastName;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
   
    public Person(){       
    }
   
    public Person(String firstName,String lastName){
        this.firstName = firstName;
        this.lastName = lastName;
    }
}


TestMongoConnection.java

Code:
import com.mongodb.Person;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class TestMongoConnection {
    public static void main(String[] args) {
        EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("mongodb-test");
        EntityManager manager = entityManagerFactory.createEntityManager();
        Person anandMohan = new Person("Anand","Mohan");
        manager.persist(anandMohan);       
        manager.close();
    }
}


I get this error
Code:
Jun 10, 2015 5:29:31 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
Jun 10, 2015 5:29:31 PM org.hibernate.ogm.datastore.impl.DatastoreProviderInitiator initiateService
INFO: OGM000016: NoSQL Datastore provider: org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider
Exception in thread "main" java.lang.NoSuchFieldError: ERRORS_IGNORED
   at org.hibernate.ogm.datastore.mongodb.options.WriteConcernType.<clinit>(WriteConcernType.java:27)
   at org.hibernate.ogm.datastore.mongodb.options.WriteConcernType.<clinit>(WriteConcernType.java:27)
   at org.hibernate.ogm.datastore.mongodb.options.impl.WriteConcernOption.<clinit>(WriteConcernOption.java:29)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
   at java.lang.Class.newInstance0(Class.java:372)
   at java.lang.Class.newInstance(Class.java:325)
   at org.hibernate.ogm.options.navigation.source.impl.ConfigurationOptionValueSource$ConfigurationBasedOptionContainer.getAll(ConfigurationOptionValueSource.java:81)
   at org.hibernate.ogm.options.navigation.impl.OptionsContextImpl.getMostSpecificContainer(OptionsContextImpl.java:138)
   at org.hibernate.ogm.options.navigation.impl.OptionsContextImpl.getAndCacheOptionsContainer(OptionsContextImpl.java:93)
   at org.hibernate.ogm.options.navigation.impl.OptionsContextImpl.getUnique(OptionsContextImpl.java:75)
   at org.hibernate.ogm.datastore.mongodb.configuration.impl.MongoDBConfiguration.<init>(MongoDBConfiguration.java:75)
   at org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider.configure(MongoDBDatastoreProvider.java:77)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
   at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:50)
   at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:34)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
   at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator$OgmDialectFactory.<init>(OgmDialectFactoryInitiator.java:44)
   at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:31)
   at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:25)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
   at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:95)
   at org.hibernate.ogm.service.impl.OgmJdbcServicesInitiator$OgmJdbcServicesImpl.configure(OgmJdbcServicesInitiator.java:50)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
   at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
   at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
   at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
   at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:63)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
   at test.TestMongoConnection.main(TestMongoConnection.java:20)
Java Result: 1


Top
 Profile  
 
 Post subject: Re: Getting NoSuchFieldsError
PostPosted: Thu Jun 11, 2015 4:57 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

We don't support the 3.0 driver yet. There is an issue for this: https://hibernate.atlassian.net/browse/OGM-810. Maybe you would be interested in helping out with doing this upgrade?

Cheers,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


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.