Mongobee MongoQueryException: there are no users authenticated










1















a spring boot application uses mongobee and mongodb, the spring data config is as below:



spring:
data:
mongodb:
uri: mongodb://james:xxxxxxx@localhost:27017/?authSource=admin
database: shortvideo


the mongodb is created and started by another docker container, when I start the application with docker-compose and prod profile, there are always below error:



hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.924 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.936 INFO 1 --- [ main] c.j.s.config.CacheConfiguration : Closing Cache Manager
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.966+0000 I ACCESS [conn3] Unauthorized: not authorized on admin to execute command endSessions: [ id: UUID("4083d867-552a-4882-8b21-fd1c2f0de0f7") ], $db: "admin", $readPreference: mode: "primaryPreferred"
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.973+0000 I NETWORK [conn3] end connection 172.25.0.3:60404 (2 connections now open)
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.974+0000 I NETWORK [conn2] end connection 172.25.0.3:60398 (1 connection now open)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.975 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.987 WARN 1 --- [ main] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:37.023 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
hdshortvideo-app_1_5c3629434c46 |
hdshortvideo-app_1_5c3629434c46 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)


When I connect to the mongodb with shell, I can find the user "james" there:



> show users

"_id" : "admin.james",
"user" : "james",
"db" : "admin",
"roles" : [

"role" : "root",
"db" : "admin"

]



So what on earth does "there are no users authenticated mean? I googled a lot but no luck, I am stuck now.










share|improve this question






















  • as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

    – Vipul
    Nov 22 '18 at 11:57















1















a spring boot application uses mongobee and mongodb, the spring data config is as below:



spring:
data:
mongodb:
uri: mongodb://james:xxxxxxx@localhost:27017/?authSource=admin
database: shortvideo


the mongodb is created and started by another docker container, when I start the application with docker-compose and prod profile, there are always below error:



hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.924 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.936 INFO 1 --- [ main] c.j.s.config.CacheConfiguration : Closing Cache Manager
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.966+0000 I ACCESS [conn3] Unauthorized: not authorized on admin to execute command endSessions: [ id: UUID("4083d867-552a-4882-8b21-fd1c2f0de0f7") ], $db: "admin", $readPreference: mode: "primaryPreferred"
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.973+0000 I NETWORK [conn3] end connection 172.25.0.3:60404 (2 connections now open)
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.974+0000 I NETWORK [conn2] end connection 172.25.0.3:60398 (1 connection now open)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.975 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.987 WARN 1 --- [ main] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:37.023 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
hdshortvideo-app_1_5c3629434c46 |
hdshortvideo-app_1_5c3629434c46 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)


When I connect to the mongodb with shell, I can find the user "james" there:



> show users

"_id" : "admin.james",
"user" : "james",
"db" : "admin",
"roles" : [

"role" : "root",
"db" : "admin"

]



So what on earth does "there are no users authenticated mean? I googled a lot but no luck, I am stuck now.










share|improve this question






















  • as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

    – Vipul
    Nov 22 '18 at 11:57













1












1








1








a spring boot application uses mongobee and mongodb, the spring data config is as below:



spring:
data:
mongodb:
uri: mongodb://james:xxxxxxx@localhost:27017/?authSource=admin
database: shortvideo


the mongodb is created and started by another docker container, when I start the application with docker-compose and prod profile, there are always below error:



hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.924 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.936 INFO 1 --- [ main] c.j.s.config.CacheConfiguration : Closing Cache Manager
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.966+0000 I ACCESS [conn3] Unauthorized: not authorized on admin to execute command endSessions: [ id: UUID("4083d867-552a-4882-8b21-fd1c2f0de0f7") ], $db: "admin", $readPreference: mode: "primaryPreferred"
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.973+0000 I NETWORK [conn3] end connection 172.25.0.3:60404 (2 connections now open)
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.974+0000 I NETWORK [conn2] end connection 172.25.0.3:60398 (1 connection now open)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.975 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.987 WARN 1 --- [ main] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:37.023 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
hdshortvideo-app_1_5c3629434c46 |
hdshortvideo-app_1_5c3629434c46 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)


When I connect to the mongodb with shell, I can find the user "james" there:



> show users

"_id" : "admin.james",
"user" : "james",
"db" : "admin",
"roles" : [

"role" : "root",
"db" : "admin"

]



So what on earth does "there are no users authenticated mean? I googled a lot but no luck, I am stuck now.










share|improve this question














a spring boot application uses mongobee and mongodb, the spring data config is as below:



spring:
data:
mongodb:
uri: mongodb://james:xxxxxxx@localhost:27017/?authSource=admin
database: shortvideo


the mongodb is created and started by another docker container, when I start the application with docker-compose and prod profile, there are always below error:



hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.924 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.936 INFO 1 --- [ main] c.j.s.config.CacheConfiguration : Closing Cache Manager
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.966+0000 I ACCESS [conn3] Unauthorized: not authorized on admin to execute command endSessions: [ id: UUID("4083d867-552a-4882-8b21-fd1c2f0de0f7") ], $db: "admin", $readPreference: mode: "primaryPreferred"
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.973+0000 I NETWORK [conn3] end connection 172.25.0.3:60404 (2 connections now open)
hdshortvideo-mongodb_1_753bbfb0d5aa | 2018-11-15T02:21:36.974+0000 I NETWORK [conn2] end connection 172.25.0.3:60398 (1 connection now open)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.975 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:36.987 WARN 1 --- [ main] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
hdshortvideo-app_1_5c3629434c46 | 2018-11-15 02:21:37.023 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
hdshortvideo-app_1_5c3629434c46 |
hdshortvideo-app_1_5c3629434c46 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/james/shortvideo/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server hdshortvideo-mongodb:27017
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
hdshortvideo-app_1_5c3629434c46 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)


When I connect to the mongodb with shell, I can find the user "james" there:



> show users

"_id" : "admin.james",
"user" : "james",
"db" : "admin",
"roles" : [

"role" : "root",
"db" : "admin"

]



So what on earth does "there are no users authenticated mean? I googled a lot but no luck, I am stuck now.







spring-data-mongodb mongobee






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 4:24









James HaoJames Hao

148111




148111












  • as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

    – Vipul
    Nov 22 '18 at 11:57

















  • as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

    – Vipul
    Nov 22 '18 at 11:57
















as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

– Vipul
Nov 22 '18 at 11:57





as your SDM shows you have used --> database: shortvideo and you have created user james ad given role to access admin db only so allow this user to access shortvideo database as well

– Vipul
Nov 22 '18 at 11:57












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53312416%2fmongobee-mongoqueryexception-there-are-no-users-authenticated%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53312416%2fmongobee-mongoqueryexception-there-are-no-users-authenticated%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

What does pagestruct do in Eviews?

Dutch intervention in Lombok and Karangasem

Channel Islands