java 怎么会出现 Run 不行,Debug 执行 就能成功?好神奇,有木有?(java,MongoDB)

Inszt 发布于 2016/03/04 11:18
阅读 763
收藏 1

代码 很简单,mongoDB的存储,我也知道 问题就在 存储 的 json 上

String txt = FileUtil.readText("files/json.txt");

		BasicDBObject dbObj = new BasicDBObject();


		dbObj.put("api_url", "111111111111111");
		dbObj.put("json_txt", txt);//存储不成功,为什么????断点就可以???


		WriteResult add = MongoDBDAO.add("test_1", dbObj);
		System.out.println(add);



直接运行存不进去,我断电 看下吧,诶?成功了?好TM 神奇。。。。。

我反复运行了 好多次,都是 断点就行了。 要不就是 都不行,这样 我就 换其他的方法,现在搞得我 不知道 到底 这样存 对不对。

你们试一下看看是不是也是。。。。还是 我哪里 忽略了?


下面是 txt 里 读取的内容,一段 json数据

{"code":"MORE-PROBALITY","data":{"diseases":[{"commonAge":"","diseaseId":2988,"diseaseName":"良性高血压","probality":"34.16","symptoms":["头晕","偶感头晕","反复头晕","失眠","鼻塞","脑动脉供血不足","便秘","脑供血不足","头痛","咳痰","乏力"]},{"commonAge":"","diseaseId":2918,"diseaseName":"脑梗死","probality":"24.40","symptoms":["脑动脉供血不足","脑供血不足","头晕","头痛","脑血管供血不足","乏力","头胀","失眠","反复头晕加剧","脑血供不足","咳嗽"]},{"commonAge":"","diseaseId":1873,"diseaseName":"脑梗死后遗症","probality":"4.59","symptoms":["偶感头晕","肢体麻木","头晕","反复头晕","乏力","头晕加重","失眠","咳嗽","便秘","右侧肢体活动不利","咽痛"]},{"commonAge":"","diseaseId":1664,"diseaseName":"眩晕综合征","probality":"4.03","symptoms":["头晕","目眩","恶心","反复头晕加剧","脑供血不足","呕吐","乏力","头痛","咳嗽","胸闷","耳鸣"]},{"commonAge":"","diseaseId":1221,"diseaseName":"原发性高血压","probality":"3.46","symptoms":["偶感头晕","头晕","反复头晕","血压高","失眠","心悸","高血脂","胸闷","乏力","发作性头晕","头痛"]},{"commonAge":"","diseaseId":1047,"diseaseName":"高脂血症","probality":"2.84","symptoms":["血脂升高","高血脂","头晕","偶感头晕","胸闷","失眠","发作性头晕","脑动脉供血不足","咳嗽","咽痛","腹胀"]}],"subSymptoms":[{"probality":"1616.75","subSymptom":"偶感头晕"},{"probality":"1178.10","subSymptom":"反复头晕"},{"probality":"186.06","subSymptom":"头晕加重"},{"probality":"106.94","subSymptom":"发作性头晕"},{"probality":"38.81","subSymptom":"阵发性头晕"},{"probality":"8.38","subSymptom":"经常头晕"},{"probality":"4.21","subSymptom":"头晕好转"},{"probality":"2.95","subSymptom":"无明显头晕"},{"probality":"0.60","subSymptom":"头晕明显"}],"symptoms":[{"distinctFlag":0,"probality":"30.15","symptom":"腰腹部肿胀"},{"distinctFlag":1,"probality":"20.35","symptom":"夜失眠"},{"distinctFlag":0,"probality":"14.69","symptom":"乏力"},{"distinctFlag":0,"probality":"13.31","symptom":"手掌发麻"},{"distinctFlag":0,"probality":"13.04","symptom":"肢体麻木"},{"distinctFlag":0,"probality":"11.61","symptom":"恶心"},{"distinctFlag":1,"probality":"10.69","symptom":"脑供血不足"},{"distinctFlag":0,"probality":"10.15","symptom":"头痛"},{"distinctFlag":1,"probality":"8.53","symptom":"脑血管供血不足"},{"distinctFlag":0,"probality":"7.00","symptom":"胸闷"},{"distinctFlag":0,"probality":"6.87","symptom":"头胀"},{"distinctFlag":1,"probality":"6.36","symptom":"头痛好转"},{"distinctFlag":0,"probality":"5.28","symptom":"目眩"},{"distinctFlag":0,"probality":"3.31","symptom":"失眠"},{"distinctFlag":0,"probality":"3.30","symptom":"咳嗽"},{"distinctFlag":0,"probality":"3.18","symptom":"耳鸣"},{"distinctFlag":0,"probality":"2.79","symptom":"心悸"},{"distinctFlag":0,"probality":"2.68","symptom":"腰腹部疼痛"},{"distinctFlag":0,"probality":"2.57","symptom":"腰腹部不适"},{"distinctFlag":0,"probality":"2.50","symptom":"易疲劳"},{"distinctFlag":0,"probality":"2.47","symptom":"疲乏无力"},{"distinctFlag":0,"probality":"2.47","symptom":"疲劳感"},{"distinctFlag":0,"probality":"2.20","symptom":"耳下降"},{"distinctFlag":0,"probality":"2.15","symptom":"肠功能紊乱"},{"distinctFlag":0,"probality":"2.05","symptom":"气促"},{"distinctFlag":0,"probality":"1.70","symptom":"呕吐"},{"distinctFlag":0,"probality":"1.58","symptom":"腹胀"},{"distinctFlag":0,"probality":"1.45","symptom":"咽喉疼"},{"distinctFlag":0,"probality":"1.45","symptom":"鼻塞"},{"distinctFlag":0,"probality":"1.43","symptom":"咽痛"},{"distinctFlag":1,"probality":"1.42","symptom":"脑动脉供血不足"},{"distinctFlag":1,"probality":"1.00","symptom":"下肢乏力好转"},{"distinctFlag":1,"probality":"0.99","symptom":"上肢发麻"},{"distinctFlag":1,"probality":"0.83","symptom":"高血脂"},{"distinctFlag":1,"probality":"0.70","symptom":"反复耳鸣"},{"distinctFlag":1,"probality":"0.60","symptom":"时有耳鸣"},{"distinctFlag":1,"probality":"0.53","symptom":"下肢乏力"},{"distinctFlag":1,"probality":"0.50","symptom":"夜寐差"},{"distinctFlag":1,"probality":"0.50","symptom":"免疫低下"},{"distinctFlag":1,"probality":"0.50","symptom":"夜间头部不适"},{"distinctFlag":1,"probality":"0.31","symptom":"胸闷加重"},{"distinctFlag":1,"probality":"0.18","symptom":"颈椎僵痛"},{"distinctFlag":1,"probality":"0.14","symptom":"右侧肢体麻木"},{"distinctFlag":1,"probality":"0.14","symptom":"左右侧肢体乏力"},{"distinctFlag":1,"probality":"0.13","symptom":"肢体活动不利"},{"distinctFlag":1,"probality":"0.12","symptom":"右侧肢体活动不利"},{"distinctFlag":1,"probality":"0.10","symptom":"月经失调"},{"distinctFlag":1,"probality":"0.08","symptom":"头部出血"},{"distinctFlag":1,"probality":"0.08","symptom":"全身酸痛"},{"distinctFlag":1,"probality":"0.05","symptom":"粉刺"},{"distinctFlag":1,"probality":"0.05","symptom":"半身麻木"},{"distinctFlag":1,"probality":"0.04","symptom":"头部伤后"},{"distinctFlag":1,"probality":"0.03","symptom":"颈后痛"},{"distinctFlag":1,"probality":"0.02","symptom":"夜间睡眠差"},{"distinctFlag":1,"probality":"0.02","symptom":"双耳鸣"},{"distinctFlag":1,"probality":"0.02","symptom":"痛经"}]},"msg":"成功返回","status":200}








加载中
1
fruitsand
fruitsand
这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。
0
金灿灿
看完标题, 马上想到是异步执行问题, 因为我遇到类似的ajax调用问题. 正如楼上说的!
0
会编程的坦克兵
会编程的坦克兵

引用来自“杜佳恒”的评论

这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。
    正解 可以在存储之前先打印下看看是否读取成功
0
Inszt
Inszt

引用来自“杜佳恒”的评论

这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。

听起来很有道理 ,但是 解释不了。。。;

首先 打印出来完全没问题,读取的是正确的。

而实际上呢,把 txt里的内容 随便换一下 比如  写个 123,没问题啊,一下就存进去了。


这么说的话,问题就在 这段json上,难道说 异步存 这段json 可以,不使用异步 就不行?那这太奇怪了吧。


再说 debug 就会产生异步吗?还是时候 只是因为 debug的时候 停了一下,有了时间差?




0
Inszt
Inszt

引用来自“杜佳恒”的评论

这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。

引用来自“小泼皮”的评论

    正解 可以在存储之前先打印下看看是否读取成功

把代码再简化一下,有mongo的环境的话 就可以复制 直接执行了,也不用 纠结 读取文本的问题了


BasicDBObject dbObj = new BasicDBObject();


		dbObj.put("api_url", "111111111111111");
		////存储不成功,为什么????断点就可以???
		dbObj.put(
				"json_txt",
				"{\"code\":\"MORE-PROBALITY\",\"data\":{\"diseases\":[{\"commonAge\":\"\",\"diseaseId\":2988,\"diseaseName\":\"良性高血压\",\"probality\":\"34.16\",\"symptoms\":[\"头晕\",\"偶感头晕\",\"反复头晕\",\"失眠\",\"鼻塞\",\"脑动脉供血不足\",\"便秘\",\"脑供血不足\",\"头痛\",\"咳痰\",\"乏力\"]},{\"commonAge\":\"\",\"diseaseId\":2918,\"diseaseName\":\"脑梗死\",\"probality\":\"24.40\",\"symptoms\":[\"脑动脉供血不足\",\"脑供血不足\",\"头晕\",\"头痛\",\"脑血管供血不足\",\"乏力\",\"头胀\",\"失眠\",\"反复头晕加剧\",\"脑血供不足\",\"咳嗽\"]},{\"commonAge\":\"\",\"diseaseId\":1873,\"diseaseName\":\"脑梗死后遗症\",\"probality\":\"4.59\",\"symptoms\":[\"偶感头晕\",\"肢体麻木\",\"头晕\",\"反复头晕\",\"乏力\",\"头晕加重\",\"失眠\",\"咳嗽\",\"便秘\",\"右侧肢体活动不利\",\"咽痛\"]},{\"commonAge\":\"\",\"diseaseId\":1664,\"diseaseName\":\"眩晕综合征\",\"probality\":\"4.03\",\"symptoms\":[\"头晕\",\"目眩\",\"恶心\",\"反复头晕加剧\",\"脑供血不足\",\"呕吐\",\"乏力\",\"头痛\",\"咳嗽\",\"胸闷\",\"耳鸣\"]},{\"commonAge\":\"\",\"diseaseId\":1221,\"diseaseName\":\"原发性高血压\",\"probality\":\"3.46\",\"symptoms\":[\"偶感头晕\",\"头晕\",\"反复头晕\",\"血压高\",\"失眠\",\"心悸\",\"高血脂\",\"胸闷\",\"乏力\",\"发作性头晕\",\"头痛\"]},{\"commonAge\":\"\",\"diseaseId\":1047,\"diseaseName\":\"高脂血症\",\"probality\":\"2.84\",\"symptoms\":[\"血脂升高\",\"高血脂\",\"头晕\",\"偶感头晕\",\"胸闷\",\"失眠\",\"发作性头晕\",\"脑动脉供血不足\",\"咳嗽\",\"咽痛\",\"腹胀\"]}],\"subSymptoms\":[{\"probality\":\"1616.75\",\"subSymptom\":\"偶感头晕\"},{\"probality\":\"1178.10\",\"subSymptom\":\"反复头晕\"},{\"probality\":\"186.06\",\"subSymptom\":\"头晕加重\"},{\"probality\":\"106.94\",\"subSymptom\":\"发作性头晕\"},{\"probality\":\"38.81\",\"subSymptom\":\"阵发性头晕\"},{\"probality\":\"8.38\",\"subSymptom\":\"经常头晕\"},{\"probality\":\"4.21\",\"subSymptom\":\"头晕好转\"},{\"probality\":\"2.95\",\"subSymptom\":\"无明显头晕\"},{\"probality\":\"0.60\",\"subSymptom\":\"头晕明显\"}],\"symptoms\":[{\"distinctFlag\":0,\"probality\":\"30.15\",\"symptom\":\"腰腹部肿胀\"},{\"distinctFlag\":1,\"probality\":\"20.35\",\"symptom\":\"夜失眠\"},{\"distinctFlag\":0,\"probality\":\"14.69\",\"symptom\":\"乏力\"},{\"distinctFlag\":0,\"probality\":\"13.31\",\"symptom\":\"手掌发麻\"},{\"distinctFlag\":0,\"probality\":\"13.04\",\"symptom\":\"肢体麻木\"},{\"distinctFlag\":0,\"probality\":\"11.61\",\"symptom\":\"恶心\"},{\"distinctFlag\":1,\"probality\":\"10.69\",\"symptom\":\"脑供血不足\"},{\"distinctFlag\":0,\"probality\":\"10.15\",\"symptom\":\"头痛\"},{\"distinctFlag\":1,\"probality\":\"8.53\",\"symptom\":\"脑血管供血不足\"},{\"distinctFlag\":0,\"probality\":\"7.00\",\"symptom\":\"胸闷\"},{\"distinctFlag\":0,\"probality\":\"6.87\",\"symptom\":\"头胀\"},{\"distinctFlag\":1,\"probality\":\"6.36\",\"symptom\":\"头痛好转\"},{\"distinctFlag\":0,\"probality\":\"5.28\",\"symptom\":\"目眩\"},{\"distinctFlag\":0,\"probality\":\"3.31\",\"symptom\":\"失眠\"},{\"distinctFlag\":0,\"probality\":\"3.30\",\"symptom\":\"咳嗽\"},{\"distinctFlag\":0,\"probality\":\"3.18\",\"symptom\":\"耳鸣\"},{\"distinctFlag\":0,\"probality\":\"2.79\",\"symptom\":\"心悸\"},{\"distinctFlag\":0,\"probality\":\"2.68\",\"symptom\":\"腰腹部疼痛\"},{\"distinctFlag\":0,\"probality\":\"2.57\",\"symptom\":\"腰腹部不适\"},{\"distinctFlag\":0,\"probality\":\"2.50\",\"symptom\":\"易疲劳\"},{\"distinctFlag\":0,\"probality\":\"2.47\",\"symptom\":\"疲乏无力\"},{\"distinctFlag\":0,\"probality\":\"2.47\",\"symptom\":\"疲劳感\"},{\"distinctFlag\":0,\"probality\":\"2.20\",\"symptom\":\"耳下降\"},{\"distinctFlag\":0,\"probality\":\"2.15\",\"symptom\":\"肠功能紊乱\"},{\"distinctFlag\":0,\"probality\":\"2.05\",\"symptom\":\"气促\"},{\"distinctFlag\":0,\"probality\":\"1.70\",\"symptom\":\"呕吐\"},{\"distinctFlag\":0,\"probality\":\"1.58\",\"symptom\":\"腹胀\"},{\"distinctFlag\":0,\"probality\":\"1.45\",\"symptom\":\"咽喉疼\"},{\"distinctFlag\":0,\"probality\":\"1.45\",\"symptom\":\"鼻塞\"},{\"distinctFlag\":0,\"probality\":\"1.43\",\"symptom\":\"咽痛\"},{\"distinctFlag\":1,\"probality\":\"1.42\",\"symptom\":\"脑动脉供血不足\"},{\"distinctFlag\":1,\"probality\":\"1.00\",\"symptom\":\"下肢乏力好转\"},{\"distinctFlag\":1,\"probality\":\"0.99\",\"symptom\":\"上肢发麻\"},{\"distinctFlag\":1,\"probality\":\"0.83\",\"symptom\":\"高血脂\"},{\"distinctFlag\":1,\"probality\":\"0.70\",\"symptom\":\"反复耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.60\",\"symptom\":\"时有耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.53\",\"symptom\":\"下肢乏力\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"夜寐差\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"免疫低下\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"夜间头部不适\"},{\"distinctFlag\":1,\"probality\":\"0.31\",\"symptom\":\"胸闷加重\"},{\"distinctFlag\":1,\"probality\":\"0.18\",\"symptom\":\"颈椎僵痛\"},{\"distinctFlag\":1,\"probality\":\"0.14\",\"symptom\":\"右侧肢体麻木\"},{\"distinctFlag\":1,\"probality\":\"0.14\",\"symptom\":\"左右侧肢体乏力\"},{\"distinctFlag\":1,\"probality\":\"0.13\",\"symptom\":\"肢体活动不利\"},{\"distinctFlag\":1,\"probality\":\"0.12\",\"symptom\":\"右侧肢体活动不利\"},{\"distinctFlag\":1,\"probality\":\"0.10\",\"symptom\":\"月经失调\"},{\"distinctFlag\":1,\"probality\":\"0.08\",\"symptom\":\"头部出血\"},{\"distinctFlag\":1,\"probality\":\"0.08\",\"symptom\":\"全身酸痛\"},{\"distinctFlag\":1,\"probality\":\"0.05\",\"symptom\":\"粉刺\"},{\"distinctFlag\":1,\"probality\":\"0.05\",\"symptom\":\"半身麻木\"},{\"distinctFlag\":1,\"probality\":\"0.04\",\"symptom\":\"头部伤后\"},{\"distinctFlag\":1,\"probality\":\"0.03\",\"symptom\":\"颈后痛\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"夜间睡眠差\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"双耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"痛经\"}]},\"msg\":\"成功返回\",\"status\":200}");


		WriteResult add = MongoDBDAO.add("test_1", dbObj);
		System.out.println(add);





结果还是一样啊,只要是这段 json 就 run不行,debug可以;

换成别的 文本 比如

 dbObj.put("json_txt", "123");

就TM没问题,直接运行就存进去了,牛了 ,我擦。




Inszt
Inszt
。。。mongoDAO
0
Inszt
Inszt

引用来自“杜佳恒”的评论

这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。

引用来自“小泼皮”的评论

    正解 可以在存储之前先打印下看看是否读取成功

引用来自“Inszt”的评论

把代码再简化一下,有mongo的环境的话 就可以复制 直接执行了,也不用 纠结 读取文本的问题了


BasicDBObject dbObj = new BasicDBObject();


		dbObj.put("api_url", "111111111111111");
		////存储不成功,为什么????断点就可以???
		dbObj.put(
				"json_txt",
				"{\"code\":\"MORE-PROBALITY\",\"data\":{\"diseases\":[{\"commonAge\":\"\",\"diseaseId\":2988,\"diseaseName\":\"良性高血压\",\"probality\":\"34.16\",\"symptoms\":[\"头晕\",\"偶感头晕\",\"反复头晕\",\"失眠\",\"鼻塞\",\"脑动脉供血不足\",\"便秘\",\"脑供血不足\",\"头痛\",\"咳痰\",\"乏力\"]},{\"commonAge\":\"\",\"diseaseId\":2918,\"diseaseName\":\"脑梗死\",\"probality\":\"24.40\",\"symptoms\":[\"脑动脉供血不足\",\"脑供血不足\",\"头晕\",\"头痛\",\"脑血管供血不足\",\"乏力\",\"头胀\",\"失眠\",\"反复头晕加剧\",\"脑血供不足\",\"咳嗽\"]},{\"commonAge\":\"\",\"diseaseId\":1873,\"diseaseName\":\"脑梗死后遗症\",\"probality\":\"4.59\",\"symptoms\":[\"偶感头晕\",\"肢体麻木\",\"头晕\",\"反复头晕\",\"乏力\",\"头晕加重\",\"失眠\",\"咳嗽\",\"便秘\",\"右侧肢体活动不利\",\"咽痛\"]},{\"commonAge\":\"\",\"diseaseId\":1664,\"diseaseName\":\"眩晕综合征\",\"probality\":\"4.03\",\"symptoms\":[\"头晕\",\"目眩\",\"恶心\",\"反复头晕加剧\",\"脑供血不足\",\"呕吐\",\"乏力\",\"头痛\",\"咳嗽\",\"胸闷\",\"耳鸣\"]},{\"commonAge\":\"\",\"diseaseId\":1221,\"diseaseName\":\"原发性高血压\",\"probality\":\"3.46\",\"symptoms\":[\"偶感头晕\",\"头晕\",\"反复头晕\",\"血压高\",\"失眠\",\"心悸\",\"高血脂\",\"胸闷\",\"乏力\",\"发作性头晕\",\"头痛\"]},{\"commonAge\":\"\",\"diseaseId\":1047,\"diseaseName\":\"高脂血症\",\"probality\":\"2.84\",\"symptoms\":[\"血脂升高\",\"高血脂\",\"头晕\",\"偶感头晕\",\"胸闷\",\"失眠\",\"发作性头晕\",\"脑动脉供血不足\",\"咳嗽\",\"咽痛\",\"腹胀\"]}],\"subSymptoms\":[{\"probality\":\"1616.75\",\"subSymptom\":\"偶感头晕\"},{\"probality\":\"1178.10\",\"subSymptom\":\"反复头晕\"},{\"probality\":\"186.06\",\"subSymptom\":\"头晕加重\"},{\"probality\":\"106.94\",\"subSymptom\":\"发作性头晕\"},{\"probality\":\"38.81\",\"subSymptom\":\"阵发性头晕\"},{\"probality\":\"8.38\",\"subSymptom\":\"经常头晕\"},{\"probality\":\"4.21\",\"subSymptom\":\"头晕好转\"},{\"probality\":\"2.95\",\"subSymptom\":\"无明显头晕\"},{\"probality\":\"0.60\",\"subSymptom\":\"头晕明显\"}],\"symptoms\":[{\"distinctFlag\":0,\"probality\":\"30.15\",\"symptom\":\"腰腹部肿胀\"},{\"distinctFlag\":1,\"probality\":\"20.35\",\"symptom\":\"夜失眠\"},{\"distinctFlag\":0,\"probality\":\"14.69\",\"symptom\":\"乏力\"},{\"distinctFlag\":0,\"probality\":\"13.31\",\"symptom\":\"手掌发麻\"},{\"distinctFlag\":0,\"probality\":\"13.04\",\"symptom\":\"肢体麻木\"},{\"distinctFlag\":0,\"probality\":\"11.61\",\"symptom\":\"恶心\"},{\"distinctFlag\":1,\"probality\":\"10.69\",\"symptom\":\"脑供血不足\"},{\"distinctFlag\":0,\"probality\":\"10.15\",\"symptom\":\"头痛\"},{\"distinctFlag\":1,\"probality\":\"8.53\",\"symptom\":\"脑血管供血不足\"},{\"distinctFlag\":0,\"probality\":\"7.00\",\"symptom\":\"胸闷\"},{\"distinctFlag\":0,\"probality\":\"6.87\",\"symptom\":\"头胀\"},{\"distinctFlag\":1,\"probality\":\"6.36\",\"symptom\":\"头痛好转\"},{\"distinctFlag\":0,\"probality\":\"5.28\",\"symptom\":\"目眩\"},{\"distinctFlag\":0,\"probality\":\"3.31\",\"symptom\":\"失眠\"},{\"distinctFlag\":0,\"probality\":\"3.30\",\"symptom\":\"咳嗽\"},{\"distinctFlag\":0,\"probality\":\"3.18\",\"symptom\":\"耳鸣\"},{\"distinctFlag\":0,\"probality\":\"2.79\",\"symptom\":\"心悸\"},{\"distinctFlag\":0,\"probality\":\"2.68\",\"symptom\":\"腰腹部疼痛\"},{\"distinctFlag\":0,\"probality\":\"2.57\",\"symptom\":\"腰腹部不适\"},{\"distinctFlag\":0,\"probality\":\"2.50\",\"symptom\":\"易疲劳\"},{\"distinctFlag\":0,\"probality\":\"2.47\",\"symptom\":\"疲乏无力\"},{\"distinctFlag\":0,\"probality\":\"2.47\",\"symptom\":\"疲劳感\"},{\"distinctFlag\":0,\"probality\":\"2.20\",\"symptom\":\"耳下降\"},{\"distinctFlag\":0,\"probality\":\"2.15\",\"symptom\":\"肠功能紊乱\"},{\"distinctFlag\":0,\"probality\":\"2.05\",\"symptom\":\"气促\"},{\"distinctFlag\":0,\"probality\":\"1.70\",\"symptom\":\"呕吐\"},{\"distinctFlag\":0,\"probality\":\"1.58\",\"symptom\":\"腹胀\"},{\"distinctFlag\":0,\"probality\":\"1.45\",\"symptom\":\"咽喉疼\"},{\"distinctFlag\":0,\"probality\":\"1.45\",\"symptom\":\"鼻塞\"},{\"distinctFlag\":0,\"probality\":\"1.43\",\"symptom\":\"咽痛\"},{\"distinctFlag\":1,\"probality\":\"1.42\",\"symptom\":\"脑动脉供血不足\"},{\"distinctFlag\":1,\"probality\":\"1.00\",\"symptom\":\"下肢乏力好转\"},{\"distinctFlag\":1,\"probality\":\"0.99\",\"symptom\":\"上肢发麻\"},{\"distinctFlag\":1,\"probality\":\"0.83\",\"symptom\":\"高血脂\"},{\"distinctFlag\":1,\"probality\":\"0.70\",\"symptom\":\"反复耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.60\",\"symptom\":\"时有耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.53\",\"symptom\":\"下肢乏力\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"夜寐差\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"免疫低下\"},{\"distinctFlag\":1,\"probality\":\"0.50\",\"symptom\":\"夜间头部不适\"},{\"distinctFlag\":1,\"probality\":\"0.31\",\"symptom\":\"胸闷加重\"},{\"distinctFlag\":1,\"probality\":\"0.18\",\"symptom\":\"颈椎僵痛\"},{\"distinctFlag\":1,\"probality\":\"0.14\",\"symptom\":\"右侧肢体麻木\"},{\"distinctFlag\":1,\"probality\":\"0.14\",\"symptom\":\"左右侧肢体乏力\"},{\"distinctFlag\":1,\"probality\":\"0.13\",\"symptom\":\"肢体活动不利\"},{\"distinctFlag\":1,\"probality\":\"0.12\",\"symptom\":\"右侧肢体活动不利\"},{\"distinctFlag\":1,\"probality\":\"0.10\",\"symptom\":\"月经失调\"},{\"distinctFlag\":1,\"probality\":\"0.08\",\"symptom\":\"头部出血\"},{\"distinctFlag\":1,\"probality\":\"0.08\",\"symptom\":\"全身酸痛\"},{\"distinctFlag\":1,\"probality\":\"0.05\",\"symptom\":\"粉刺\"},{\"distinctFlag\":1,\"probality\":\"0.05\",\"symptom\":\"半身麻木\"},{\"distinctFlag\":1,\"probality\":\"0.04\",\"symptom\":\"头部伤后\"},{\"distinctFlag\":1,\"probality\":\"0.03\",\"symptom\":\"颈后痛\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"夜间睡眠差\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"双耳鸣\"},{\"distinctFlag\":1,\"probality\":\"0.02\",\"symptom\":\"痛经\"}]},\"msg\":\"成功返回\",\"status\":200}");


		WriteResult add = MongoDBDAO.add("test_1", dbObj);
		System.out.println(add);





结果还是一样啊,只要是这段 json 就 run不行,debug可以;

换成别的 文本 比如

 dbObj.put("json_txt", "123");

就TM没问题,直接运行就存进去了,牛了 ,我擦。




mongoDAO.add

public static WriteResult add(String table, BasicDBObject dbo) {
		
		
		DBCollection collection = getMongoDB().getCollection(table);
		WriteResult result = collection.insert(dbo);
		return result;
	}



0
panda大侠
panda大侠
"头晕","偶感头晕","反复头晕","失眠","鼻塞","脑动脉供血不足","便秘","脑供血不足","头痛","咳痰","乏力" 就吃舒经健腰瓦
Inszt
Inszt
。。。。。。。。。
0
z
zhzzzzzz
就我的经验,应该是异步时,存储数据量超时
Inszt
Inszt
对,确实是这样,谢谢.
0
Inszt
Inszt

引用来自“杜佳恒”的评论

这种情况一般是异步导致的,断点执行的时候异步操作已经完成所以可以使用异步操作的结果,直接执行可能异步操作还没执行完,所以操作返回的结果就是空或是未定义。你可以去看看你那个FileUtil是怎么读文件的。

是的,我用VisualVM 看到 两个线程,多出一个守护线程。

我才  直接运行  可能 会 导致 守护线程 被结束,插入失败,而Debug 会 有个 等待 时间 ,让守护线程运行完。

所以,手动 等待 几秒钟,也 插入成功了。

谢谢。

返回顶部
顶部