I have an environment on Jelastic, their support wasn't able to help :P
I setup Tomcat 7.0.55 with java 8 and MongoDB 2.6.4 For mongo i also setup an external ip so i can access from my local tomcat.
Here what happen, I am able to run my local Tomcat and Jelastic remote Mongo DB But when deployed, i get this log from the remote mongo
2015-01-07T22:57:29.637+0000 [conn22208] authenticate db: easylend {authenticate: 1, user: "cre8tech", nonce: "xxx", key: "xxx" }
2015-01-07T22:57:29.638+0000 [conn22208] Failed to authenticate cre8tech@easylend with mechanism MONGODB-CR: AuthenticationFailed keymismatch
I am 1000% sure that the credential is correct and so the method use to log because i am able to use it locally to their remote mongo + i can access to it by using
mongo XXXX.whelastic.net/{myDbName} --username {username} --password {password}
@Bean
@Override
public Mongo mongo() throws Exception {
ServerAddress serverAdress = new ServerAddress(host, Integer.parseInt(port));
Mongo mongo = null;
if (usr != null && !usr.isEmpty()) {
MongoCredential credential = MongoCredential.createMongoCRCredential(usr, database, pwd.toCharArray());
mongo = new MongoClient(serverAdress, Arrays.asList(credential));
} else {
mongo = new MongoClient(serverAdress);
}
mongo.setWriteConcern(WriteConcern.SAFE);
return mongo;
}
The log on tomcat just says that it cannot be authenticated
com.mongodb.CommandFailureException: { "serverUsed" : "********" , "code" : 18 , "ok" : 0.0 , "errmsg" : "auth fails"}
My theory is that the remote Jelastic tomcat may contains some jar/libs that interfere with the mongo driver I use
Thanks for your helps