相关文章推荐
温文尔雅的圣诞树  ·  DAY25 MongoDB ...·  1 月前    · 
刀枪不入的马铃薯  ·  mongodb "errmsg" : ...·  1 月前    · 
风度翩翩的排球  ·  Android ...·  1 年前    · 
买醉的墨镜  ·  google test cmake ...·  2 年前    · 
彷徨的豌豆  ·  postgres fixed length ...·  2 年前    · 
风流的鞭炮  ·  计算模拟之道 - 知乎·  2 年前    · 


Spring、SpringMVC、MyBatis框架整合 MongoDb ,启动web项目时出现异常,项目不能运行,查看原因是出现如下异常:

with root cause org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to type java.lang.Long

异常堆栈如下

org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [springMvcDispatcherServlet] in context with path [/conference] threw exception [Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to type java.lang.Long] with root cause
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to type java.lang.Long

解决方法:

Spring使用MongoDb帮助文档

在MongoDb里要求每个文档都需要有 _id 字段,java类中有如下情况会被映射为 _id 字段

  • 如果1个字段加上了 @Id (org.springframework.data.annotation.Id) 注解,那么将bean保存到数据库时就会把该字段映射为文档中的 _id 字段
  • 如果java对象中没有 @Id 注解,名字为 id 的字段将会被映射为文档中的 _id 字段
web项目整合MongoDb出现No converter found capable of converting from org.bson.types.ObjectId to type Long异常 SSM框架整合 MongoDb ,启动项目时出现异常,出现如下异常:with root cause org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to Long
一、写在前面   人人都想成为全栈码农,作为一个 web 前端开发人员,通往全栈的简洁之路,貌似就是node.js了。前段时间学习了node.js,来谈谈新手如何快速的搭建自己的 web 服务,开启全栈之路。 二、安装node.js   接触过后端开发的人都知道,首先要安装服务。作为新手,肯定是选择最简单的可视化安装了(傻瓜式下一步,其它的方式等熟悉相关操作后自然就会了的),通过官网http://nodejs. org /dist/v0.6.1/node-v0.6.1.msi 下载电脑适配的安装包(这个是windows的,买不起mac啊),然后根据引导安装就可以了,默认安装在C:\Program File
解决错误: No converter found ca pable of convert ing from type [ java .lang.Str ing ] to type [ java .lang.Class
<dependency> <group Id >com.alibaba</group Id > <artifact Id >dru id -spr ing -boot-starter</artifact Id > <version>... 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
Object Id ,在mongo中,存储的文档必须有一个"_ id "键。这个键的值可以是任何类型的,默认是个 Object Id 对象。 之前在把 Object Id 类型的json格式转化成 Object Id 时候报错。用的是fastjson工具,下面是main方法模拟的报错代码: public static vo id main(Str ing [] args) { Object Id id = Object Id .get(); JSON Object json Object = (JSON Object )
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java :39) sun.reflect.Delegat ing MethodAccessorImpl.invoke(Delegat
No converter found ca pable of convert ing from type [ java .lang.Str ing ] to type [ java .util.Map< java .lang.Str ing , java .lang.Str ing >]错误的一个可能原因 在启动spr ing boot项目时报错,具体如下:
在使用 Spr ing Data JPA 时遇到报错:No converter found ca pable of convert ing from type [ java .lang.Integer] to type [com.wchat.bean.Group] 报错详细内容如下 org .spr ing framework.core. convert . Converter NotFoundException:...
今天在对象集合转字符串的时候,我直接用的toStr ing ,报错对象不能转成字符串: *.*.* ca nnot be ca st to java .lang.Str ing 刚开始直接用的toStr ing ()方法,可是不行,后来查了下,有的说是对象不能直接用toStr ing ()方法转接成字符串,后来找到了解决方法: List result = new ArrayList(); Str ing str
web项目整合MongoDb出现No converter found capable of converting from org.bson.types.ObjectId to type Long异常 24323 web项目整合MongoDb出现No converter found capable of converting from org.bson.types.ObjectId to type Long异常 Qing_dyq: 这个问题出现是因为我ObjectId 导包没导mongo的包 Windows Server 2012安装密钥 weixin_46084735: 新蜜蜂(new bee) Nginx错误日志:recv() failed (104: Connection reset by peer) while reading response header from upstream 阿里云Ubuntu服务器使用apt-get安装maven,构建项目出现 org.apache.maven.plugin.compiler.CompilationFailureException