java.lang.IllegalArgumentException: clusterListener can not be null

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.MongoClient]: Factory method ‘mongo‘ threw exception; nested exception is java.lang.IllegalArgumentException: clusterListener can not be null
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    ... 18 common frames omitted
Caused by: java.lang.IllegalArgumentException: clusterListener can not be null
    at com.mongodb.assertions.Assertions.notNull(Assertions.java:37) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.ClusterSettings$Builder.addClusterListener(ClusterSettings.java:218) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.DefaultClusterFactory.getClusterSettings(DefaultClusterFactory.java:190) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.DefaultClusterFactory.create(DefaultClusterFactory.java:80) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.Mongo.createCluster(Mongo.java:682) ~[mongodb-driver-3.2.2.jar:na]
    at com.mongodb.Mongo.createCluster(Mongo.java:668) ~[mongodb-driver-3.2.2.jar:na]
    at com.mongodb.Mongo.createCluster(Mongo.java:642) ~[mongodb-driver-3.2.2.jar:na]
    at com.mongodb.Mongo.<init>(Mongo.java:289) ~[mongodb-driver-3.2.2.jar:na]
    at com.mongodb.MongoClient.<init>(MongoClient.java:268) ~[mongodb-driver-3.2.2.jar:na]
    at org.springframework.boot.autoconfigure.mongo.MongoClientFactory.createMongoClient(MongoClientFactory.java:111) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoClientFactory.createNetworkMongoClient(MongoClientFactory.java:107) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoClientFactory.createMongoClient(MongoClientFactory.java:67) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.mongo(MongoAutoConfiguration.java:70) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration$$EnhancerBySpringCGLIB$$634858fd.CGLIB$mongo$1(<generated>) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration$$EnhancerBySpringCGLIB$$634858fd$$FastClassBySpringCGLIB$$85823a2.invoke(<generated>) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration$$EnhancerBySpringCGLIB$$634858fd.mongo(<generated>) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    ... 19 common frames omitted
查看 pom依赖
                <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver</artifactId>
            <version>3.2.2</version>
        </dependency>    

将依赖改为3.6版本就解决Exception

原文地址:https://www.cnblogs.com/oldzhang1222/p/9543715.html

时间: 2024-10-10 14:24:08

java.lang.IllegalArgumentException: clusterListener can not be null的相关文章

严重: End event threw exception java.lang.IllegalArgumentException: Can&#39;t convert argument: null

堆栈信息: 2014-6-17 10:33:58 org.apache.tomcat.util.digester.Digester endElement 严重: End event threw exception java.lang.IllegalArgumentException: Can't convert argument: null at org.apache.tomcat.util.IntrospectionUtils.convert(IntrospectionUtils.java:1

java.lang.IllegalArgumentException: Can&#39;t convert argument: null

从SVN下载项目后,我把项目名称改了一下然后启动tomcat后就一直报java.lang.IllegalArgumentException: Can't convert argument: null这个错. 解决办法是:第一步.将web.xml文件的头文件以javaee:开始的命名空间删除.如图: 第二步:将web.xml文件中所有javaee:替换成空白.如图: 重启tomcat,问题解决! java.lang.IllegalArgumentException: Can't convert a

java.lang.IllegalArgumentException: The observer is null.最终解决方案

在使用数据适配的时候的问题: java.lang.IllegalArgumentException: The observer is null. at android.database.Observable.unregisterObserver(Observable.java:64) at android.widget.BaseAdapter.unregisterDataSetObserver(BaseAdapter.java:42) at android.widget.AbsListView.

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;

今天在配置spring-security.xml配置文件时出错 错误如下: 严重: Servlet.service() for servlet [security] in context with path [] threw exception java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" at org.springframework.security.c

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;报错

出现问题的原因: 内存用户验证时,Spring boot 2.0.1引用的security 依赖是 spring security 5.X版本,此版本需要提供一个PasswordEncorder的实例,否则后台汇报错误: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 并且页面毫无响应. 解决方法: 创建PasswordEncorder的实现类MyPassw

java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity

今天想把ssh整合的代码跑起来,控制台就一直在报错,搞了半天!!! Hibernate: select computer0_.computerId as computer1_0_, computer0_.computerName as computer2_0_, computer0_.computerPrice as computer3_0_, computer0_.computerType as computer4_0_ from computer computer0_java.lang.Il

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”

在spring security中设置默认的登录人的信息,遇到的异常信息: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null” 有些版本不要求这样子做,所以就不会有该问题的发生, 我现在用的是5.0版本,强制要求提供一个,所以我们就给一个PasswordEncoder给他. 我们也可以使用Spring自带的PasswordEncoder.为了方便起见,我们以明文形式存密码

解决java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;

问题描述: 使用springboot,权限管理使用spring security,使用内存用户验证,但无响应报错: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 解决方式 ①: 创建MyPasswordEncoder类实现PasswordEncoder,加注解  @Component @Component public class MyPasswordEn

Mybatis java.lang.IllegalArgumentException: uncategorized SQLException for SQL []; SQL state [null]

1.数据库字段原类型为Date 类型,因为数据原因,将该字段换为String类型,结果导致Mybatis 报出java.lang.illegalargumentexception, 因为数据库的变动我并不知晓,所以这个问题查了好久 2.解决过程 首先认为是SQL原因,但是Mybatis 组装的语句放到PLSQL中执行没有错误 接下来定位到数据库更换是不是有地方不一样,结果找到了有相同命名的一个字段,原数据库类型为Date ,改变数据库后,字段类型为String 下面就定位到执行SQL后,返回的数