互联网服务数据库

JAVA操作Informix 12.10.FC5的nosql出错

在Informix 12.10.FC5版本中,支持Mongo的nosql,需要启动监听如下:java -cp  $INFORMIXDIR/bin/jsonListener.jar com.ibm.nosql.informix.server.ListenerCLI -config  $INFORMIXDIR/etc/jsonListener.properties -start

用java操作:

MongoClient mongoClient = new MongoClient("localhost",27017);

MongoDatabase db = mongoClient.getDatabase("stores_demo");

MongoCollection collection = db.getCollection("customer");

System.out.println(collection.find());//可以正常打印

System.out.println("=========================================");

System.out.println(collection.find().iterator());//出错

错误信息如下:

Jul 4, 2016 2:36:56 PM com.mongodb.diagnostics.logging.JULLogger log

INFO: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}

com.mongodb.FindIterableImpl@5c1428ea

=========================================

Jul 4, 2016 2:36:57 PM com.mongodb.diagnostics.logging.JULLogger log

INFO: No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, all=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out

Jul 4, 2016 2:36:57 PM com.mongodb.diagnostics.logging.JULLogger log

INFO: Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoException: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type STRING

at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125)

at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128)

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

Caused by: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type STRING

at org.bson.BsonValue.throwIfInvalidType(BsonValue.java:397)

at org.bson.BsonValue.asInt32(BsonValue.java:94)

at com.mongodb.connection.DescriptionHelper.getVersion(DescriptionHelper.java:121)

at com.mongodb.connection.DescriptionHelper.createConnectionDescription(DescriptionHelper.java:58)

at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:85)

at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43)

at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)

... 2 more

参与4

1同行回答

spiderliujiespiderliujie软件架构设计师GBase
请提供online.log文件,帮忙分析显示全部

请提供online.log文件,帮忙分析

收起
互联网服务 · 2016-07-07
浏览550

提问者

chenjx583
软件开发工程师星火

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2016-07-04
  • 关注会员:2 人
  • 问题浏览:1563
  • 最近回答:2016-07-07
  • X社区推广