-----遇到问题-----cas启用mongodb验证方式报错com.mongodb.CommandFailureException---Authentication failed(转)

https://blog.csdn.net/zzq900503/article/details/54931456








单点登录(十)-----遇到问题-----cas启用mongodb验证方式报错com.mongodb.CommandFailureException---Authentication failed

2017年02月08日 19:34:52 张小凡vip 阅读数:8037更多

所属专栏: 单点登录运用和解析

 版权声明:本文为博主原创文章,未经博主允许不得转载。https://blog.csdn.net/q383965374/article/details/54931456

cas启用mongodb验证方式报错com.mongodb.CommandFailureException---Authentication failed。

完整报错信息:

二月08,20175:34:32下午 org.apache.catalina.core.ApplicationContext log

信息: Initializing Spring root WebApplicationContext

2017-02-0817:34:39,577INFO [org.jasig.cas.services.DefaultServicesManagerImpl] -

2017-02-0817:34:40,186INFO [org.jasig.cas.services.DefaultServicesManagerImpl] -

2017-02-0817:34:43,445WARN [org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler] -

2017-02-0817:34:44,182INFO [org.jasig.cas.ticket.registry.TicketRegistryCleaner] -

2017-02-0817:34:44,183INFO [org.jasig.cas.ticket.registry.TicketRegistryCleaner] -

2017-02-0817:34:44,506WARN [org.jasig.cas.util.NoOpCipherExecutor] - <[org.jasig.cas.util.NoOpCipherExecutor] does no encryption and may NOT be safe in a production environment. Consider using other choices, such as [org.jasig.cas.util.BaseStringCipherExecutor] that handle encryption, signing and verification of all appropriate values.>

2017-02-0817:34:44,592WARN [org.jasig.cas.util.TGCCipherExecutor] -

2017-02-0817:34:44,601WARN [org.jasig.cas.util.TGCCipherExecutor] -

2017-02-0817:34:44,601WARN [org.jasig.cas.util.TGCCipherExecutor] -

2017-02-0817:34:44,601WARN [org.jasig.cas.util.TGCCipherExecutor] -

2017-02-0817:34:44,640WARN [org.jasig.cas.util.WebflowCipherExecutor] -

2017-02-0817:34:44,640WARN [org.jasig.cas.util.WebflowCipherExecutor] -

2017-02-0817:34:44,641WARN [org.jasig.cas.util.WebflowCipherExecutor] -

2017-02-0817:34:44,642WARN [org.jasig.cas.util.WebflowCipherExecutor] -

2017-02-0817:34:45,595WARN [org.springframework.web.context.support.XmlWebApplicationContext] -

2017-02-0817:34:46,054WARN [org.jasig.cas.services.JsonServiceRegistryConfigWatcher] -

2017-02-0817:34:46,057ERROR [org.springframework.web.context.ContextLoader] -

org.springframework.beans.factory.BeanCreationException: Error creating bean with name'mongoServiceRegistryDao': Invocation of init method failed; nested exception is org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

Caused by: org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:99)

at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2013)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:448)

at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:516)

at org.jasig.cas.services.MongoServiceRegistryDao.init(MongoServiceRegistryDao.java:57)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)

...27more

Caused by: com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at com.mongodb.CommandResult.getException(CommandResult.java:76)

at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)

at com.mongodb.DBPort$SaslAuthenticator.authenticate(DBPort.java:899)

at com.mongodb.DBPort.authenticate(DBPort.java:432)

at com.mongodb.DBPort.checkAuth(DBPort.java:443)

at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:289)

at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:269)

at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)

at com.mongodb.DB.command(DB.java:320)

at com.mongodb.DB.command(DB.java:299)

at com.mongodb.DB.command(DB.java:388)

at com.mongodb.DBApiLayer.getCollectionNames(DBApiLayer.java:152)

at com.mongodb.DB.collectionExists(DB.java:524)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:518)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:516)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:446)

...36more

>

二月08,20175:34:46下午 org.apache.catalina.core.StandardContext listenerStart

严重: Exception sending context initialized event to listener instance ofclassorg.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'mongoServiceRegistryDao':Invocationofinitmethodfailed; nested exception is org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

Caused by: org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:99)

at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2013)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:448)

at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:516)

at org.jasig.cas.services.MongoServiceRegistryDao.init(MongoServiceRegistryDao.java:57)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)

...27more

Caused by: com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at com.mongodb.CommandResult.getException(CommandResult.java:76)

at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)

at com.mongodb.DBPort$SaslAuthenticator.authenticate(DBPort.java:899)

at com.mongodb.DBPort.authenticate(DBPort.java:432)

at com.mongodb.DBPort.checkAuth(DBPort.java:443)

at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:289)

at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:269)

at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)

at com.mongodb.DB.command(DB.java:320)

at com.mongodb.DB.command(DB.java:299)

at com.mongodb.DB.command(DB.java:388)

at com.mongodb.DBApiLayer.getCollectionNames(DBApiLayer.java:152)

at com.mongodb.DB.collectionExists(DB.java:524)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:518)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:516)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:446)

...36more

二月08,20175:34:46下午 org.apache.catalina.core.StandardContext listenerStart

严重: Exception sending context initialized event to listener instance ofclassorg.jasig.cas.CasEnvironmentContextListener

org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'mongoServiceRegistryDao':Invocationofinitmethodfailed; nested exception is org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSin

gletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

Caused by: org.springframework.dao.PermissionDeniedDataAccessException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}; nested exception is com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:99)

at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2013)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:448)

at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:516)

at org.jasig.cas.services.MongoServiceRegistryDao.init(MongoServiceRegistryDao.java:57)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305)

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)

...27more

Caused by: com.mongodb.CommandFailureException: {"serverUsed":"192.168.30.249:27017","ok":0.0,"code":18,"errmsg":"Authentication failed."}

at com.mongodb.CommandResult.getException(CommandResult.java:76)

at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)

at com.mongodb.DBPort$SaslAuthenticator.authenticate(DBPort.java:899)

at com.mongodb.DBPort.authenticate(DBPort.java:432)

at com.mongodb.DBPort.checkAuth(DBPort.java:443)

at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:289)

at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:269)

at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)

at com.mongodb.DB.command(DB.java:320)

at com.mongodb.DB.command(DB.java:299)

at com.mongodb.DB.command(DB.java:388)

at com.mongodb.DBApiLayer.getCollectionNames(DBApiLayer.java:152)

at com.mongodb.DB.collectionExists(DB.java:524)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:518)

at org.springframework.data.mongodb.core.MongoTemplate$6.doInDB(MongoTemplate.java:516)

at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:446)

...36more

二月08,20175:34:46下午 org.apache.catalina.core.StandardContext startInternal

严重: Error listenerStart

二月08,20175:34:46下午 org.apache.catalina.core.StandardContext startInternal

严重: Context [/cas] startup failed due to previous errors

二月08,20175:34:46下午 org.apache.catalina.core.ApplicationContext log

信息: Closing Spring root WebApplicationContext

二月08,20175:34:46下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads

严重: The web application [/cas] appears to have started a thread named [Log4j2-Log4j2Scheduled-1] but has failed to stop it. This is very likely to create a memory leak.

二月08,20175:34:46下午 org.apache.catalina.startup.HostConfig deployDirectory

信息: Deploying web application directory F:\tomcat7\webapps\client2

二月08,20175:34:46下午 org.apache.catalina.loader.WebappClassLoader validateJarFile

信息: validateJarFile(F:\tomcat7\webapps\client2\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded. See Servlet Spec2.3, section9.7.2. Offendingclass:javax/el/Expression.class

二月 08, 2017 5:34:46 下午org.apache.catalina.loader.WebappClassLoadervalidateJarFile

信息:validateJarFile(F:\tomcat7\webapps\client2\WEB-INF\lib\servlet-api-2.5.jar) -jarnotloaded.SeeServletSpec2.3,section9.7.2.Offendingclass:javax/servlet/Servlet.class

SLF4J:Failedtoloadclass"org.slf4j.impl.StaticLoggerBinder".

SLF4J:Defaultingtono-operation(NOP)loggerimplementation

SLF4J:Seehttp://www.slf4j.org/codes.html#StaticLoggerBinderforfurtherdetails.

二月 08, 2017 5:34:47 下午org.apache.catalina.startup.HostConfigdeployDirectory

信息:DeployingwebapplicationdirectoryF:\tomcat7\webapps\ROOT

二月 08, 2017 5:34:47 下午org.apache.coyote.AbstractProtocolstart

信息:StartingProtocolHandler["http-apr-8080"]

二月 08, 2017 5:34:47 下午org.apache.coyote.AbstractProtocolstart

信息:StartingProtocolHandler["ajp-apr-8009"]

二月 08, 2017 5:34:47 下午org.apache.catalina.startup.Catalinastart

信息:Serverstartupin34194ms

{ "serverUsed" : "192.168.30.249:27017" , "ok" : 0.0 , "code" : 18 , "errmsg" : "Authentication failed."}

是一种比较常见的错误。

就是认证失败,帐号密码连接mongodb认证错误。

查看mongodb的log日志也可以得到相关信息:

I ACCESS   [conn1914] SCRAM-SHA-1 authentication failed for  on testCrm from client 192.168.30.39 ; BadValue: Incorrect SCRAM-SHA-1 user name: n=

log一般存放在/data/mongodb/log文件夹路径。

这种情况分两种:

一种是mongodb数据库本身有启用身份验证的,需要检查帐号密码是否正确。

最好的方式就是 在mongo  shell里在需要连接的数据库上进行db.auth(user,password),返回1则正确,返回0失败。

或者

mongo --authenticationDatabase dbName -u user -p

第二种是mongodb数据库本身没有启用身份验证

既然没有启用身份验证,为什么这里又去验证了帐号密码呢,显然是我们的连接方式和连接语句有问题。

我们注意到cas server对mongodb的连接方式使用的是com.mongodb.MongoClientURI方式,也就是使用的uri。

 <bean id="clientUri" class="com.mongodb.MongoClientURI"          c:uri="mongodb://${mongodb.userId}:${mongodb.userPassword}@${mongodb.host}:${mongodb.port}/${cas.service.registry.mongo.db}" />

配置文件和情况如下:

这里我们就发现问题了。

我们是把user和password空着,但是在配置文件里还是把空当作帐号密码来认证了,所以报错了。

我们查看官网的文档:

https://docs.mongodb.com/manual/reference/connection-string/

发现帐号和密码是非必须的

所以com.mongodb.MongoClientURI连接mongodb当没有启用帐号认证,用户名和密码为空时,使用的连接语句应该是

<bean id="clientUri" class="com.mongodb.MongoClientURI"          c:uri="mongodb://${mongodb.host}:${mongodb.port}/${cas.service.registry.mongo.db}" />

如图,不再报错了。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,324评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,303评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,192评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,555评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,569评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,566评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,927评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,583评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,827评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,590评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,669评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,365评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,941评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,928评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,159评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,880评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,399评论 2 342

推荐阅读更多精彩内容