org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.Document] to type [java.lang.String]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1402) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1355) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readProperties(MappingMongoConverter.java:336) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:292) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:245) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:194) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:190) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:78) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate$ReadDocumentCallback.doWith(MongoTemplate.java:2800) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2416) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:2208) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:717) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:705) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
出现上面的错误是因为设置DefaultMongoTypeMapper为null,不能映射
将上面注释掉就好了
Mongodb org.springframework.core.convert.ConverterNotFoundException: No converter found capable
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.Document] to type [java.lang.String] at org.springframework.core.convert.s...
Traceback (most recent
ca
ll last):
File /home/cisco/spark-mongo-test.py, line 7, in
df = spark.read.format(com.
mongodb
.spark.sql.DefaultSource).load()
File /home/cisco/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/readwriter.py, line 165, in load
mongodb
查询报错No
converter
found
ca
pable
of
convert
ing from type [
org
.bson.BsonUndefined]
查询数据返回对象集合,出现了undifined数据,无法转换为实体类中的String类型。
定位脏数据,删除或者修复数据
重点对脏数据如何产生进行排查,修改程序
mongodb
查询undefined数据
db.getCollection('tableName').find({"fieldName":{$
在
MongoDb
里要求每个文档都需要有_id 字段,java类中有如下情况会被映射为_id字段
如果1个字段加上了 @Id (
org
.
springframework
.data.annotation.Id)注解,那么将bean保存到数据库时就会把该字段映射为文档中的_id字段
如果java对象中没有 @Id 注解,名字为id 的字段将会被映...
No
converter
found
ca
pable
of
convert
ing from type [
org
.bson.BsonUndefined] to type [java.lang.Integer]
由于库中存在undefined的type类型所以首先去表中把字段为undefined的找出来清除即可
db.gift_
ca
rd.update({price:{$type:"undefined"}},{$unset:{price:""}},{multi:1});
剩下就是找代码bug解
MongoDB
查找数据时出现的错误,记录一下,防止自己再犯。
// 查找所有学校的信息
List<School> list = mongoTemplate.findAll(School.class,"school");
for (School school : list){
System.out.println( school.getName() + "" +school.getAddr());
出现下面的错误:
Exc
eption
in thread "main"
org
.spr
2021-11-05 springMVC 错误:
org
.
springframework
.http.
converter
.HttpMessageNotWritableExc
eption
: No conve…
springMVC返回json格式问题
对象转json返回json字符串问题分析
springMVC返回json格式问题
对象转json返回json字符串问题分析
在SpringMVC(默认支持jackson)中返回Json字符串需要表明@ResponseBody注解,此时出现了转换异常问
项目中的异步审计日志一直抛栈溢出异常。日志如下
Exc
eption
in thread "golog-pool-1-thread-1" java.lang.StackOverflowError
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at
org
.
springframework
.data.
convert
.CustomConversions$TargetTypes.computeIfAbsent(C
2018-08-13 14:01:51.885 ERROR 10244 --- [nio-8082-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] :
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exc
eption
[Reques...
FATAL: remaining connection slots are reserved for non-replication superuser connections
数据工具人:
java编译时error: illegal character '\ufeff' 的解决办法
ijohnnymiller:
FATAL: remaining connection slots are reserved for non-replication superuser connections
m0_49281435:
Thymeleaf #numbers 显示千分位金额,保留小数位
嗯嗯**: