MongoDB查询报错:class com.mongodb.MongoSecurityException: Exception authenticating MongoCredential
异常日志:
-- ::, [http-nio--exec-] DEBUG [java.sql.Connection] - ooo Connection Opened
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Executing: insert into client_config ( appid, uid, config, created_time, creater, client_type, status ) values ( ?, ?, ?, now(), ?, ?, ? )
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Parameters: (String), wulinfeng(String), By continuing to use our website, you agree with our use of cookies in accordance with our Cookie Policy.You can reject cookies by changing your browser settings.(String), 系统管理员(String), (String), (String)
key=business:businessclientconfig:::wulinfeng
-- ::, [http-nio--exec-] DEBUG [java.sql.Connection] - ooo Connection Opened
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Executing: select id,data_key,description,valid_time,status,created_time from cache_memcache_data where data_key like 'business:businessclientconfig:1:1234:wulinfeng%'
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Parameters:
-- ::, [http-nio--exec-] INFO [org.mongodb.driver.connection] - Closed connection [connectionId{localValue:}] to localhost: because there was a socket exception raised by this connection.
-- ::, [http-nio--exec-] DEBUG [java.sql.Connection] - ooo Connection Opened
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Executing: INSERT INTO log_web_exception ( op_user, op_user_name, error_level, page_name, class_name, method, input_params, log_desc, log_stack, create_time,source_type) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, now(),'');
-- ::, [http-nio--exec-] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 系统管理员(String), admin(String), (String), 客户端配置(String), com.wlf.musicbox.business.controller.ClientConfigController(String), saveClientConfig(String), {"id":,"appid":"","config":"By continuing to use our website, you agree with our use of cookies in accordance with our Cookie Policy.You can reject cookies by changing your browser settings.","creater":"系统管理员","status":"","uid":"wulinfeng","clientType":""}(String), 保存客户端配置信息异常(String), class com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-, userName='', source='admin', password=<hidden>, mechanismProperties={}}
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: wrapException,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: access$,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator$, 方法名: run,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator$, 方法名: run,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: doAsSubject,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: authenticate,行数:
类名: com.mongodb.internal.connection.InternalStreamConnectionInitializer, 方法名: authenticateAll,行数:
类名: com.mongodb.internal.connection.InternalStreamConnectionInitializer, 方法名: initialize,行数:
类名: com.mongodb.internal.connection.InternalStreamConnection, 方法名: open,行数:
类名: com.mongodb.internal.connection.UsageTrackingInternalConnection, 方法名: open,行数:
类名: com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection, 方法名: open,行数:
类名: com.mongodb.internal.connection.DefaultConnectionPool, 方法名: get,行数:
类名: com.mongodb.internal.connection.DefaultConnectionPool, 方法名: get,行数:
类名: com.mongodb.internal.connection.DefaultServer, 方法名: getConnection,行数:
类名: com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource, 方法名: getConnection,行数:
类名: com.mongodb.operation.OperationHelper, 方法名: withConnectionSource,行数:
com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-, userName='', source='admin', password=<hidden>, mechanismProperties={}}
类名: com.mongodb.operation.OperationHelper, 方法名: withConnection,行数:
类名: com.mongodb.operation.FindOperation, 方法名: execute,行数:
类名: com.mongodb.operation.FindOperation, 方法名: execute,行数:
类名: com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor, 方法名: execute,行数:
类名: com.mongodb.client.internal.MongoIterableImpl, 方法名: execute,行数:
类名: com.mongodb.client.internal.MongoIterableImpl, 方法名: iterator,行数:
类名: com.ll.musicbox.commonlibmongo.MongoDBUtil, 方法名: findAllCommonRecordsWithFiled,行数:
类名: com.ll.musicbox.commonlibmongo.MongoDBUtil, 方法名: findAllCommonRecords,行数:
类名: com.wlf.musicbox.system.service.MemCacheService, 方法名: getMemFromMongoForBlur,行数:
类名: com.wlf.musicbox.business.service.CommonService, 方法名: delMemFromMongoForBlur,行数:
类名: com.wlf.musicbox.business.service.CommonService, 方法名: delMemByKeyValue,行数:
类名: com.wlf.musicbox.business.controller.ClientConfigController, 方法名: saveClientConfig,行数:
类名: sun.reflect.NativeMethodAccessorImpl, 方法名: invoke0,行数: -
类名: sun.reflect.NativeMethodAccessorImpl, 方法名: invoke,行数:
类名: sun.reflect.DelegatingMethodAccessorImpl, 方法名: invoke,行数:
类名: java.lang.reflect.Method, 方法名: invoke,行数:
at com.mongodb.internal.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:)
类名: org.springframework.web.method.support.InvocableHandlerMethod, 方法名: invoke,行数:
at com.mongodb.internal.connection.SaslAuthenticator.access$(SaslAuthenticator.java:)
类名: org.springframework.web.method.support.InvocableHandlerMethod, 方法名: invokeForRequest,行数:
at com.mongodb.internal.connection.SaslAuthenticator$.run(SaslAuthenticator.java:)
at com.mongodb.internal.connection.SaslAuthenticator$.run(SaslAuthenticator.java:)
类名: org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod, 方法名: invokeAndHandle,行数:
at com.mongodb.internal.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:)
类名: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter, 方法名: invokeHandlerMethod,行数:
类名: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter, 方法名: handleInternal,行数:
at com.mongodb.internal.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:)
类名: org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter, 方法名: handle,行数:
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:)
类名: org.springframework.web.servlet.DispatcherServlet, 方法名: doDispatch,行数:
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:)
类名: org.springframework.web.servlet.DispatcherServlet, 方法名: doService,行数:
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:)
类名: org.springframework.web.servlet.FrameworkServlet, 方法名: processRequest,行数:
at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:)
类名: org.springframework.web.servlet.FrameworkServlet, 方法名: doPost,行数:
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:)
类名: javax.servlet.http.HttpServlet, 方法名: service,行数:
at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:)
类名: javax.servlet.http.HttpServlet, 方法名: service,行数:
at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:)
类名: org.apache.tomcat.websocket.server.WsFilter, 方法名: doFilter,行数:
at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
at com.mongodb.operation.FindOperation.execute(FindOperation.java:)
at com.mongodb.operation.FindOperation.execute(FindOperation.java:)
类名: org.springframework.web.filter.CharacterEncodingFilter, 方法名: doFilterInternal,行数:
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:)
类名: org.springframework.web.filter.OncePerRequestFilter, 方法名: doFilter,行数:
at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
at com.ll.musicbox.commonlibmongo.MongoDBUtil.findAllCommonRecordsWithFiled(MongoDBUtil.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
at com.ll.musicbox.commonlibmongo.MongoDBUtil.findAllCommonRecords(MongoDBUtil.java:)
类名: com.wlf.musicbox.filter.HttpRequestFitler, 方法名: doFilter,行数:
at com.wlf.musicbox.system.service.MemCacheService.getMemFromMongoForBlur(MemCacheService.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
at com.wlf.musicbox.business.service.CommonService.delMemFromMongoForBlur(CommonService.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
at com.wlf.musicbox.business.service.CommonService.delMemByKeyValue(CommonService.java:)
类名: org.apache.shiro.web.servlet.ProxiedFilterChain, 方法名: doFilter,行数:
at com.wlf.musicbox.business.controller.ClientConfigController.saveClientConfig(ClientConfigController.java:)
类名: org.apache.shiro.web.servlet.AdviceFilter, 方法名: executeChain,行数:
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
类名: org.apache.shiro.web.servlet.AdviceFilter, 方法名: doFilterInternal,行数:
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
类名: org.apache.shiro.web.servlet.OncePerRequestFilter, 方法名: doFilter,行数:
at java.lang.reflect.Method.invoke(Method.java:)
类名: org.apache.shiro.web.servlet.ProxiedFilterChain, 方法名: doFilter,行数:
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:)
类名: org.apache.shiro.web.servlet.AbstractShiroFilter, 方法名: executeChain,行数:
类名: org.apache.shiro.web.servlet.AbstractShiroFilter$, 方法名: call,行数:
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:)
类名: org.apache.shiro.subject.support.SubjectCallable, 方法名: doCall,行数:
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:)
类名: org.apache.shiro.subject.support.SubjectCallable, 方法名: call,行数:
at javax.servlet.http.HttpServlet.service(HttpServlet.java:)
类名: org.apache.shiro.subject.support.DelegatingSubject, 方法名: execute,行数:
at javax.servlet.http.HttpServlet.service(HttpServlet.java:)
类名: org.apache.shiro.web.servlet.AbstractShiroFilter, 方法名: doFilterInternal,行数:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
类名: org.apache.shiro.web.servlet.OncePerRequestFilter, 方法名: doFilter,行数:
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
类名: org.springframework.web.filter.DelegatingFilterProxy, 方法名: invokeDelegate,行数:
类名: org.springframework.web.filter.DelegatingFilterProxy, 方法名: doFilter,行数:
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:)
类名: org.apache.catalina.core.StandardWrapperValve, 方法名: invoke,行数:
类名: org.apache.catalina.core.StandardContextValve, 方法名: invoke,行数:
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
类名: org.apache.catalina.authenticator.AuthenticatorBase, 方法名: invoke,行数:
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
类名: org.apache.catalina.core.StandardHostValve, 方法名: invoke,行数:
类名: org.apache.catalina.valves.ErrorReportValve, 方法名: invoke,行数:
at com.wlf.musicbox.filter.HttpRequestFitler.doFilter(HttpRequestFitler.java:)
类名: org.apache.catalina.valves.AbstractAccessLogValve, 方法名: invoke,行数:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
类名: org.apache.catalina.core.StandardEngineValve, 方法名: invoke,行数:
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:)
类名: org.apache.catalina.connector.CoyoteAdapter, 方法名: service,行数:
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:)
类名: org.apache.coyote.http11.Http11Processor, 方法名: service,行数:
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:)
类名: org.apache.coyote.AbstractProcessorLight, 方法名: process,行数:
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
类名: org.apache.coyote.AbstractProtocol$ConnectionHandler, 方法名: process,行数:
类名: org.apache.tomcat.util.net.NioEndpoint$SocketProcessor, 方法名: doRun,行数:
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:)
类名: org.apache.tomcat.util.net.SocketProcessorBase, 方法名: run,行数:
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:)
类名: java.util.concurrent.ThreadPoolExecutor, 方法名: runWorker,行数:
at org.apache.shiro.web.servlet.AbstractShiroFilter$.call(AbstractShiroFilter.java:)
类名: java.util.concurrent.ThreadPoolExecutor$Worker, 方法名: run,行数:
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:)
类名: org.apache.tomcat.util.threads.TaskThread$WrappingRunnable, 方法名: run,行数:
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:)
类名: java.lang.Thread, 方法名: run,行数:
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:)
(String)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
-- ::, [http-nio--exec-] ERROR [com.wlf.musicbox.business.controller.ClientConfigController] - 添加客户端配置异常:class com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-, userName='', source='admin', password=<hidden>, mechanismProperties={}}
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:)
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: wrapException,行数:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: access$,行数:
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
类名: com.mongodb.internal.connection.SaslAuthenticator$, 方法名: run,行数:
类名: com.mongodb.internal.connection.SaslAuthenticator$, 方法名: run,行数:
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:)
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: doAsSubject,行数:
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
类名: com.mongodb.internal.connection.SaslAuthenticator, 方法名: authenticate,行数:
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:)
类名: com.mongodb.internal.connection.InternalStreamConnectionInitializer, 方法名: authenticateAll,行数:
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
类名: com.mongodb.internal.connection.InternalStreamConnectionInitializer, 方法名: initialize,行数:
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
类名: com.mongodb.internal.connection.InternalStreamConnection, 方法名: open,行数:
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:)
类名: com.mongodb.internal.connection.UsageTrackingInternalConnection, 方法名: open,行数:
类名: com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection, 方法名: open,行数:
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
类名: com.mongodb.internal.connection.DefaultConnectionPool, 方法名: get,行数:
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:)
类名: com.mongodb.internal.connection.DefaultConnectionPool, 方法名: get,行数:
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:)
类名: com.mongodb.internal.connection.DefaultServer, 方法名: getConnection,行数:
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:)
类名: com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource, 方法名: getConnection,行数:
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:)
类名: com.mongodb.operation.OperationHelper, 方法名: withConnectionSource,行数:
at org.apache.tomcat.类名: com.mongodb.operation.OperationHelper, 方法名: withConnection,行数:
util.net.SocketProcessorBase.run(SocketProcessorBase.java:)
类名: com.mongodb.operation.FindOperation, 方法名: execute,行数:
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
类名: com.mongodb.operation.FindOperation, 方法名: execute,行数:
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
类名: com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor, 方法名: execute,行数:
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
类名: com.mongodb.client.internal.MongoIterableImpl, 方法名: execute,行数:
at java.lang.Thread.run(Thread.java:)
类名: com.mongodb.client.internal.MongoIterableImpl, 方法名: iterator,行数:
Caused by: com.mongodb.MongoCommandException: Command failed with error (AuthenticationFailed): 'Authentication failed.' on server localhost:. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : , "codeName" : "AuthenticationFailed" }
类名: com.ll.musicbox.commonlibmongo.MongoDBUtil, 方法名: findAllCommonRecordsWithFiled,行数:
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:)
类名: com.ll.musicbox.commonlibmongo.MongoDBUtil, 方法名: findAllCommonRecords,行数:
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:)
类名: com.wlf.musicbox.system.service.MemCacheService, 方法名: getMemFromMongoForBlur,行数:
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:)
类名: com.wlf.musicbox.business.service.CommonService, 方法名: delMemFromMongoForBlur,行数:
at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:)
类名: com.wlf.musicbox.business.service.CommonService, 方法名: delMemByKeyValue,行数:
at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:)
类名: com.wlf.musicbox.business.controller.ClientConfigController, 方法名: saveClientConfig,行数:
at com.mongodb.internal.connection.SaslAuthenticator.sendSaslStart(SaslAuthenticator.java:)
类名: sun.reflect.NativeMethodAccessorImpl, 方法名: invoke0,行数: -
at com.mongodb.internal.connection.SaslAuthenticator.access$(SaslAuthenticator.java:)
类名: sun.reflect.NativeMethodAccessorImpl, 方法名: invoke,行数:
at com.mongodb.internal.connection.SaslAuthenticator$.run(SaslAuthenticator.java:)
类名: sun.reflect.DelegatingMethodAccessorImpl, 方法名: invoke,行数:
... more
类名: java.lang.reflect.Method, 方法名: invoke,行数:
类名: org.springframework.web.method.support.InvocableHandlerMethod, 方法名: invoke,行数:
类名: org.springframework.web.method.support.InvocableHandlerMethod, 方法名: invokeForRequest,行数:
类名: org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod, 方法名: invokeAndHandle,行数:
类名: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter, 方法名: invokeHandlerMethod,行数:
类名: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter, 方法名: handleInternal,行数:
类名: org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter, 方法名: handle,行数:
类名: org.springframework.web.servlet.DispatcherServlet, 方法名: doDispatch,行数:
类名: org.springframework.web.servlet.DispatcherServlet, 方法名: doService,行数:
类名: org.springframework.web.servlet.FrameworkServlet, 方法名: processRequest,行数:
类名: org.springframework.web.servlet.FrameworkServlet, 方法名: doPost,行数:
类名: javax.servlet.http.HttpServlet, 方法名: service,行数:
类名: javax.servlet.http.HttpServlet, 方法名: service,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
类名: org.apache.tomcat.websocket.server.WsFilter, 方法名: doFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
类名: org.springframework.web.filter.CharacterEncodingFilter, 方法名: doFilterInternal,行数:
类名: org.springframework.web.filter.OncePerRequestFilter, 方法名: doFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
类名: com.wlf.musicbox.filter.HttpRequestFitler, 方法名: doFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
类名: org.apache.shiro.web.servlet.ProxiedFilterChain, 方法名: doFilter,行数:
类名: org.apache.shiro.web.servlet.AdviceFilter, 方法名: executeChain,行数:
类名: org.apache.shiro.web.servlet.AdviceFilter, 方法名: doFilterInternal,行数:
类名: org.apache.shiro.web.servlet.OncePerRequestFilter, 方法名: doFilter,行数:
类名: org.apache.shiro.web.servlet.ProxiedFilterChain, 方法名: doFilter,行数:
类名: org.apache.shiro.web.servlet.AbstractShiroFilter, 方法名: executeChain,行数:
类名: org.apache.shiro.web.servlet.AbstractShiroFilter$, 方法名: call,行数:
类名: org.apache.shiro.subject.support.SubjectCallable, 方法名: doCall,行数:
类名: org.apache.shiro.subject.support.SubjectCallable, 方法名: call,行数:
类名: org.apache.shiro.subject.support.DelegatingSubject, 方法名: execute,行数:
类名: org.apache.shiro.web.servlet.AbstractShiroFilter, 方法名: doFilterInternal,行数:
类名: org.apache.shiro.web.servlet.OncePerRequestFilter, 方法名: doFilter,行数:
类名: org.springframework.web.filter.DelegatingFilterProxy, 方法名: invokeDelegate,行数:
类名: org.springframework.web.filter.DelegatingFilterProxy, 方法名: doFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: internalDoFilter,行数:
类名: org.apache.catalina.core.ApplicationFilterChain, 方法名: doFilter,行数:
类名: org.apache.catalina.core.StandardWrapperValve, 方法名: invoke,行数:
类名: org.apache.catalina.core.StandardContextValve, 方法名: invoke,行数:
类名: org.apache.catalina.authenticator.AuthenticatorBase, 方法名: invoke,行数:
类名: org.apache.catalina.core.StandardHostValve, 方法名: invoke,行数:
类名: org.apache.catalina.valves.ErrorReportValve, 方法名: invoke,行数:
类名: org.apache.catalina.valves.AbstractAccessLogValve, 方法名: invoke,行数:
类名: org.apache.catalina.core.StandardEngineValve, 方法名: invoke,行数:
类名: org.apache.catalina.connector.CoyoteAdapter, 方法名: service,行数:
类名: org.apache.coyote.http11.Http11Processor, 方法名: service,行数:
类名: org.apache.coyote.AbstractProcessorLight, 方法名: process,行数:
类名: org.apache.coyote.AbstractProtocol$ConnectionHandler, 方法名: process,行数:
类名: org.apache.tomcat.util.net.NioEndpoint$SocketProcessor, 方法名: doRun,行数:
类名: org.apache.tomcat.util.net.SocketProcessorBase, 方法名: run,行数:
类名: java.util.concurrent.ThreadPoolExecutor, 方法名: runWorker,行数:
类名: java.util.concurrent.ThreadPoolExecutor$Worker, 方法名: run,行数:
类名: org.apache.tomcat.util.threads.TaskThread$WrappingRunnable, 方法名: run,行数:
类名: java.lang.Thread, 方法名: run,行数:
调用链有点长,关键看标黄那一行,无非admin数据库做用户验证失败了。先看看系统启动时建立MongoDB数据库连接时的用户名和密码设置:
MongoDBUtil.getInstance().init(Cfg.get("configinfo.mongo.addr"),
Integer.valueOf(Cfg.get("configinfo.mongo.pool")),
3000, Cfg.get("configinfo.mongo.user"), Cfg.get ("configinfo.mongo.pwd"), null);
这里的配置均从application.properties文件中读取:
configinfo.mongo.addr=localhost:27017
configinfo.mongo.pool=20
configinfo.mongo.user=
configinfo.mongo.pwd=
从上面看到我一开始并未设置用户名和密码,导致校验失败。那么我们来给admin设置一下用户名和密码:
> use admin
switched to db admin
> db.createUser({user:"wlf",pwd:"123",roles:["readWrite"]})
Successfully added user: { "user" : "wlf", "roles" : [ "readWrite" ] }
> db.auth("wlf","123")
1
对应的配置项也改下:
configinfo.mongo.user=wlf
configinfo.mongo.pwd=123
然后重启下tomcat让配置生效,再跑下看看,这次没有再报错了。但有一点我觉得比较奇怪的是,我并未设置数据库为admin,为啥MongoDB默认就跑到admin了?看了MongoDBUtil类我才恍然大悟:
public synchronized void initWithTimeOutAndIsAuth(String address, int poolSize, int timeOut, String user, String pwd, ReadPreference readPreference, boolean isAuth) throws UnknownHostException, MongoException {
if (poolSize == -1) {
poolSize = 200;
} System.setProperty("MONGO.POOLSIZE", String.valueOf(poolSize));
if (this.mongo == null) {
List<ServerAddress> saddrs = new ArrayList();
String[] addrs = address.split(";");
String[] var13 = addrs;
int var12 = addrs.length; for(int var11 = 0; var11 < var12; ++var11) {
String addr = var13[var11];
String[] tmp = addr.split(":");
if (tmp.length == 2) {
ServerAddress a = new ServerAddress(tmp[0], Integer.valueOf(tmp[1]));
saddrs.add(a);
}
} Builder builder = new Builder();
builder.connectionsPerHost(poolSize).connectTimeout(timeOut).socketTimeout(timeOut).heartbeatConnectTimeout(3000).heartbeatSocketTimeout(3000).serverSelectionTimeout(timeOut).maxWaitTime(timeOut).maxConnectionIdleTime(timeOut);
if (readPreference != null) {
builder.readPreference(readPreference);
} MongoClientOptions options = builder.build();
MongoCredential mongoCredential = null;
if (isAuth) {
mongoCredential = MongoCredential.createCredential(user, "admin", pwd.toCharArray());
} if (saddrs.size() == 1) {
if (isAuth) {
this.mongo = new MongoClient((ServerAddress)saddrs.get(0), mongoCredential, options);
} else {
this.mongo = new MongoClient((ServerAddress)saddrs.get(0), options);
}
} else if (isAuth) {
this.mongo = new MongoClient(saddrs, mongoCredential, options);
} else {
this.mongo = new MongoClient(saddrs, options);
}
} }
MongoDB查询报错:class com.mongodb.MongoSecurityException: Exception authenticating MongoCredential的更多相关文章
- 在DBeaver中phoenix查询报错:org.apache.phoenix.exception.PhoenixIOException: The system cannot find the path specified
环境:Phoenix:4.4,win7系统 问题:Phoenix在查询hbase时,报"系统找不到指定路径". 解决: 请参见 https://distcp.quora.com/C ...
- 【MongoDB异常】Exception authenticating MongoCredential解决方法
我们通过ideal编辑器编辑 springboot时候,出现这个错误: com.mongodb.MongoSecurityException: Exception authenticating Mon ...
- MongoDB 聚合查询报错
1.Distinct聚合查询报错 db.users.distinct("uname") db.runCommand({"distinct":"user ...
- 树莓派 mongodb 安装&报错处理
树莓派 mongodb 安装&报错处理 编译过的源码下载地址: http://files.cnblogs.com/files/xueshanshan/mongodb-rpi.zip addus ...
- 关于express 连接 mongodb数据库报错
关于express 连接 mongodb数据库报错 nodejs DeprecationWarning: current URL string parser is deprecated, and wi ...
- sqli注入--利用information_schema配合双查询报错注入
目录 sqli-labs 5.6双查询报错注入通关 0x01 获取目标库名 0x02 获取库中表的数量 0x03 获取库中表名 0x04 获取目标表中的列数 0x05 获取目标表的列名 0x06 从列 ...
- sql注入--双查询报错注入原理探索
目录 双查询报错注入原理探索 part 1 场景复现 part 2 形成原因 part 3 报错原理 part 4 探索小结 双查询报错注入原理探索 上一篇讲了双查询报错查询注入,后又参考了一些博客, ...
- sql注入--双查询报错注入
sql注入--双查询报错注入 背景:在sqli-labs第五关时,即使sql语句构造成功页面也没有回显出我们需要的信息,看到了有使用双查询操作造成报错的方式获得数据库信息,于是研究了一下双查询的报错原 ...
- MySQL查询报错 ERROR: No query specified
今天1网友,查询报错ERROR: No query specified,随后它发来截图. root case:查询语法错误 \G后面不能再加分号;,由于\G在功能上等同于;,假设加了分号,那么就是;; ...
随机推荐
- diff算法实现
大致流程 var vnode = { tag: 'ul', attrs: { id: 'list' }, children: [{ tag: 'li', attrs: { className: 'it ...
- 2019-ACM-ICPC-南京区网络赛-D. Robots-DAG图上概率动态规划
2019-ACM-ICPC-南京区网络赛-D. Robots-DAG图上概率动态规划 [Problem Description] 有向无环图中,有个机器人从\(1\)号节点出发,每天等概率的走到下 ...
- 基于Java+Selenium的WebUI自动化测试框架(九)-----基础页面类(BasePage)
上篇我们写了java读取xml文件的类,实现了可以从xml文件读取元素的方式.那么,接下来我们需要考虑一个问题.我们拿了这些元素之后怎么去操作呢? 先来看看我们手工测试的时候是怎么进行的. 双击浏览器 ...
- MaxTenuringThreshold与阈值的动态调整理论详解
今天会学习“MaxTenuringThreshold”这样一个新的JVM参数,编写的示例还是会基于上一次的代码,新建个类,如下: 接下来给它设置JVM的参数,具体如下: 而接下来会新增三个参数: 这个 ...
- eclipse中JDK环境的搭建
现在就可以用记事本开发java程序了,但是eclipse是一款java开发不可缺少的IDE,并且安装简单,下面说一下步骤,首先下载eclipse, 官网下载链接:http://www.eclipse. ...
- flutter,flutter版本version/channel切换问题
flutter go,官方的指南版本如下: 如何设置版本和channel,尝试 flutter help,发现原来flutter version不单是可以查所有版本(--version查当前版本)还可 ...
- Selenium(十二)嵌套frame定位
第一种:iframe有id.name属性 网页上有3个frame:header.menu.main,分别代码顶部.左侧.右侧(其中menu.main在另外一个frameset中) 如何定位到“head ...
- [Ynoi2017]由乃的OJ
题意 由乃正在做她的OJ.现在她在处理OJ上的用户排名问题.OJ上注册了n个用户,编号为1-",一开始他们按照编号 排名.由乃会按照心情对这些用户做以下四种操作,修改用户的排名和编号:然而由 ...
- P2P system: Chord
DHT= Distributed Hash Table store the objects(files) at nodes (hosts, machines) in a cluster. The cl ...
- CF C. Vladik and fractions——构造题
题目 构造一组 $x, y, z$,使得对于给定的 $n$,满足 $\frac{1}{x} + \frac{1}{y} + \frac{1}{z} = \frac{2}{n}$. 分析: 样例二已 ...