Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javers + Spring data + Mongo does not work #156

Closed
swarooprath opened this issue May 22, 2015 · 4 comments
Closed

Javers + Spring data + Mongo does not work #156

swarooprath opened this issue May 22, 2015 · 4 comments

Comments

@swarooprath
Copy link

@swarooprath swarooprath commented May 22, 2015

I tried to create a simple example using Javers + Mongo + spring data + spring. It does not work and my application crashes before the context is initialized. I see that Javers uses deprecated api getDb on MongoClient below. The example on your website uses the constructor new Mongo() which is deprecated and fails as well. Am copying my code block, links to your website and stacktrace below.

Link to documentation:
http://javers.org/documentation/spring-integration/

Code:
public class JaversMongoMain {
public static void main(String args[]) {
MongoRepository mongoRepo = new MongoRepository(new MongoClient().getDB("test"));
System.out.print(3);
}
}

Stacktrace :
May 21, 2015 5:22:51 PM com.mongodb.diagnostics.logging.JULLogger log
INFO: Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
May 21, 2015 5:22:51 PM com.mongodb.diagnostics.logging.JULLogger log
INFO: Exception in monitor thread while connecting to server 127.0.0.1:27017
com.mongodb.MongoException: java.lang.IllegalAccessError: tried to access class com.mongodb.MongoNamespace from class com.mongodb.connection.CommandHelper
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError: tried to access class com.mongodb.MongoNamespace from class com.mongodb.connection.CommandHelper
at com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:86)
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83)
at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)
... 2 more

May 21, 2015 5:23:01 PM com.mongodb.diagnostics.logging.JULLogger log
INFO: Exception in monitor thread while connecting to server 127.0.0.1:27017
com.mongodb.MongoException: java.lang.IllegalAccessError: com/mongodb/MongoNamespace
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError: com/mongodb/MongoNamespace
at com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:86)
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83)
at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)
... 2 more

@swarooprath
Copy link
Author

@swarooprath swarooprath commented May 22, 2015

Here is a link to my repo. My attempt of saving one entity to Mongo using Spring + Spring data + Javers : https://github.com/swarooprath/mongo/tree/master/javers

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 23, 2015

@swarooprath if you are using Mongo 3.0 - this is a known issue.
Javers works with Mongo 2.6, and simply does not work with Mongo 3.0. Mongo guys did braking changes in mongo-client API.

Upgrading javers to Mongo 3.0 is high in our backlog, we plan to make it happen in this month, stay tuned

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 24, 2015

JaVers 1.2.5 is released. We updated MongoDB Java Driver to 3.0
http://javers.org/documentation/features/#release-notes
check it out

@swarooprath
Copy link
Author

@swarooprath swarooprath commented May 25, 2015

Thanks for fixing this, will check it. Yes, am on mongo3.
Mongodb version is : db version v3.0.2
The version number of all the jars I used and along with the code are in my public github repo's build.gradle. Copying the link from above for easy reference: https://github.com/swarooprath/mongo/blob/master/javers/build.gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.