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

Unable to connect to MongoDB Atlas #8665

Closed
michael-pratt opened this issue Oct 28, 2018 · 6 comments
Closed

Unable to connect to MongoDB Atlas #8665

michael-pratt opened this issue Oct 28, 2018 · 6 comments
Milestone

Comments

@michael-pratt
Copy link

Overview of the issue

Using JHipster 5, I am unable to connect to a MongoDB Atlas cluster (running version 4.0.3). This could be an issue with spring-data, but figured I'd start here.

Stack trace is:

Motivation for or Use Case

Cannot start application due to connection failure.

Reproduce the error

Start a free tier MongoDB atlas cluster. Here's the YAML I am using:

spring:
    data:
        mongodb:
            uri: mongodb://<USER>:<PASSWORD>@XXXXX-shard-00-00-m4gfg.mongodb.net:27017,XXXXX-shard-00-01-m4gfg.mongodb.net:27017,XXXXX-shard-00-02-m4gfg.mongodb.net:27017/test?ssl=true&replicaSet=XXXXX-shard-0&authSource=admin&retryWrites=true
            database: MyDatabase

Error message is:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/mike/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 8000 and error message 'user is not allowed to do action [find] on [XXXXX.system.indexes]' on server XXXXX-shard-00-01-m4gfg.mongodb.net:27017

I have ensured the user I am connecting with has the readWriteAnyDatabase@admin roles in Atlas.

Possibly related to this issue mentioned on StackOverflow:

https://stackoverflow.com/questions/49958635/mongodb-atlas-user-is-not-allowed-to-do-action-find-on-system-indexes

JHipster Version(s)

5.5.0

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mike"
    },
    "jhipsterVersion": "5.5.0",
    "applicationType": "monolith",
    "baseName": "pelotonduel",
    "packageName": "com.mike",
    "packageFolder": "com/mike",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "prodDatabaseType": "mongodb",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "XXXXX",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

git version 2.17.1 (Apple Git-112)

node: v9.11.1

npm: 6.4.1

yeoman: 2.0.5

Docker version 18.06.1-ce, build e68fc7a

docker-compose version 1.22.0, build f46880f

@ruddell
Copy link
Member

ruddell commented Oct 28, 2018

Looks like a Mongobee issue mongobee/mongobee#87, maybe mongock (a fork of mongobee) is something to look into if mongobee is no longer maintained.

@michael-pratt
Copy link
Author

Thanks. Looks like Mongock isn’t a simple drop in replacement. Is there a way in jhipster to disable migration functionality that mongobee provides?

@michael-pratt
Copy link
Author

Answered my own question...removing the @Bean definition from public Mongobee mongobee(...) in DatabaseConfiguration.java seems to do the trick. Haven't done any thorough testing, but the apps starts and I can create new users.

@michael-pratt
Copy link
Author

Since Mongobee appears to have been abandoned, is there any interest in moving to Mongock? After a little tinkering I got it working, and would be happy to submit a PR.

@pascalgrimaud
Copy link
Member

pascalgrimaud commented Oct 30, 2018

@michael-pratt : I think it deserves a specific ticket for that. Can you open a new one and describe it plz ? So we can discuss about it

@jdubois jdubois added this to the 5.6.0 milestone Nov 2, 2018
SudharakaP added a commit to OpenArchitex/AccoTech that referenced this issue Sep 29, 2020
This is due to Mongobee having a bug that prevents it from working with Mongo Atlas correctly; jhipster/generator-jhipster#8665
@agherashyam2000
Copy link

agherashyam2000 commented Apr 2, 2021

After removing the @bean definition from public Mongobee mongobee(...) in DatabaseConfiguration.java, the app starts and I can create new users. But after creating new user the activation link using email is not sent to users and also I can not able to logged in !
Can you suggest any solution ?

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

No branches or pull requests

5 participants