NPE on save/find

5 views
Skip to first unread message

Chris Carrier

unread,
Feb 22, 2011, 8:30:23 PM2/22/11
to mongodb-user
Hey ya'll I've been trying to debug a problem in our code all day
today and haven't made much progress so I wanted to see if the error
is familiar to anyone else. Basically I am working on some Java code
to sync data from a SQL database to Mongo. When I test this locally
it seems fine but when I try running it against our production data I
start to see NPE's that look like:

java.lang.NullPointerException
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:276)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:151)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:141)
at com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:299)
at com.mongodb.DBCollection.update(DBCollection.java:125)
at com.mongodb.DBCollection.save(DBCollection.java:545)
at com.mongodb.DBCollection.save(DBCollection.java:517)

I am getting the NPE at the same line when my code calls 'find' as
well. I am on version 2.4 of the Java driver and Mongo 1.6.5. Anyone
ever seen this before or have any insight for what might be causing
it?

Thanks!
Chris

Chris Carrier

unread,
Feb 22, 2011, 8:46:41 PM2/22/11
to mongod...@googlegroups.com
Is there any work around I could try in the meantime or should i just
be waiting it out? I only see the errors in certain cases but I don't
really see any pattern to it.

Thanks
Chris

On Tue, Feb 22, 2011 at 5:37 PM, Bernie Hackett <ber...@10gen.com> wrote:
> We've seen these issues internally as well. There are fixes coming in
> the next java driver release (later this week hopefully) that should
> address this issue.

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

Chris Carrier

unread,
Feb 22, 2011, 9:10:56 PM2/22/11
to mongod...@googlegroups.com
Nope I'm just running a single Mongo instance. No replicas or
anything fancy at all. I guess i can put in some code to catch the
NPE and retry though.

On Tue, Feb 22, 2011 at 6:07 PM, Bernie Hackett <ber...@10gen.com> wrote:
> I'm assuming that you are reading from and writing to a replica set?
> In that case you may be able to work around the find() issue by using
> slaveOk to do reads from a secondary. The only workaround for save()
> is to catch the NPE and retry the writes.

Bernie Hackett

unread,
Feb 22, 2011, 9:07:53 PM2/22/11
to mongodb-user
I'm assuming that you are reading from and writing to a replica set?
In that case you may be able to work around the find() issue by using
slaveOk to do reads from a secondary. The only workaround for save()
is to catch the NPE and retry the writes.

Bernie Hackett

unread,
Feb 22, 2011, 8:37:51 PM2/22/11
to mongodb-user
We've seen these issues internally as well. There are fixes coming in
the next java driver release (later this week hopefully) that should
address this issue.

On Feb 23, 1:30 am, Chris Carrier <ctcarr...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages