|
Hibernate OGM doesn't work when you use secured database, i.e. you provide username and password.
-
create a secured MongoDB database named "ogm_test_database", you can use e.g. mongolab.com
-
git clone https://github.com/ppitonak/hibernate-ogm.git
-
cd hibernate-ogm
-
git checkout secured_mongodb
-
export MONGODB_HOSTNAME=ds045027.mongolab.com
-
export MONGODB_PORT=45027
-
export MONGODB_USERNAME=someUsername
-
export MONGODB_PASSWORD=someP@ssw0rd
-
mvn clean install -s settings-example.xml -DuseExternalMongoDb -f integrationtest/pom.xml
result:
-
failed test, connecting to database using Mongo shell works fine
Caused by: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"MongoDBModuleMemberRegistrationIT.war#primary\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MongoDBModuleMemberRegistrationIT.war#primary\": javax.persistence.PersistenceException: [PersistenceUnit: primary] Unable to build Hibernate SessionFactory Caused by: javax.persistence.PersistenceException: [PersistenceUnit: primary] Unable to build Hibernate SessionFactory Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.ogm.persister.SingleTableOgmEntityPersister Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.GridDialect] Caused by: org.hibernate.HibernateException: OGM001213: MongoDB authentication failed with username [myUser]"}} at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134) at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123) at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85) at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42) at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.deploy(ServerDeploymentHelper.java:55) at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:77) ... 96 more
|