-
Type: Improvement
-
Resolution: Done
-
None
-
Affects Version/s: None
-
Component/s: Documentation
-
Environment:Windows 7 Enterprise, SP1, 64 bits
MongoDB 2.6.5
Mongo java driver 2.12.4
Java 1.7.0_67
*Location*: http://docs.mongodb.org/ecosystem/tutorial/use-java-dbobject-to-perform-saves/#java-dbobject-to-perform-saves
*User-Agent*: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0
*Referrer*: http://docs.mongodb.org/ecosystem/drivers/java/
*Screen Resolution*: 1680 x 1050
*repo*: docs-ecosystem
*source*: tutorial/use-java-dbobject-to-perform-saves
Windows 7 Enterprise, SP1, 64 bits MongoDB 2.6.5 Mongo java driver 2.12.4 Java 1.7.0_67 *Location*: http://docs.mongodb.org/ecosystem/tutorial/use-java-dbobject-to-perform-saves/#java-dbobject-to-perform-saves *User-Agent*: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0 *Referrer*: http://docs.mongodb.org/ecosystem/drivers/java/ *Screen Resolution*: 1680 x 1050 *repo*: docs-ecosystem *source*: tutorial/use-java-dbobject-to-perform-saves
Hi.
When I implement Java DBObject to Perform Saves' exemple exactly as described in the tutorial, I get the following exception :
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NullPointerException
at com.mongodb.DBCollection._checkKeys(DBCollection.java:1801)
at com.mongodb.DBCollection._checkObject(DBCollection.java:1789)
at com.mongodb.DBCollectionImpl.applyRulesForInsert(DBCollectionImpl.java:392)
at com.mongodb.DBCollectionImpl.insertWithCommandProtocol(DBCollectionImpl.java:381)
at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:186)
at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:165)
at com.mongodb.DBCollection.insert(DBCollection.java:93)
at com.mongodb.DBCollection.insert(DBCollection.java:78)
at com.mongodb.DBCollection.insert(DBCollection.java:120)
at tweet.Tweet.main(Tweet.java:27)
... 5 more
Could you tell if its a known bug or clarify how to persist a Java object in MongoDB?
Best regards,
Lionel Ketterer
Reporter: Lionel Ketterer
E-mail: lionel.ketterer@thalesgroup.com