org.bson.types.ObjectId can not be found in source packages

225 views
Skip to first unread message

Xybrek

unread,
Jan 18, 2012, 7:57:28 AM1/18/12
to mongod...@googlegroups.com
I'm getting this error for my java app:

org.bson.types.ObjectId can not be found in source packages. Check
the inheritance chain from your module; it may not be inheriting a
required module or a module may not be adding its source path entries
properly.

I have `mongo-2.7.2.jar` in the Java Build path

And BTW, it's weird because I can fairly use other Class and Methods in
the mongo library jar. My application can persist and query the
database, but without having a DTO with ObjectId.

However, I really need to implement document id.

Nat

unread,
Jan 18, 2012, 8:13:45 AM1/18/12
to mongod...@googlegroups.com
Are you using gwt? Make sure that you don't expose it to gwt directly.
--
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.

Xybrek

unread,
Jan 18, 2012, 11:13:51 AM1/18/12
to mongod...@googlegroups.com
On 1/18/2012 9:13 PM, Nat wrote:
> Are you using gwt? Make sure that you don't expose it to gwt directly.
> -----Original Message-----
> From: Xybrek<xyb...@gmail.com>
> Sender: mongod...@googlegroups.com
> Date: Wed, 18 Jan 2012 20:57:28
> To:<mongod...@googlegroups.com>
> Reply-To: mongod...@googlegroups.com
> Subject: [mongodb-user] org.bson.types.ObjectId can not be found in source packages
>
> I'm getting this error for my java app:
>
> org.bson.types.ObjectId can not be found in source packages. Check
> the inheritance chain from your module; it may not be inheriting a
> required module or a module may not be adding its source path entries
> properly.
>
> I have `mongo-2.7.2.jar` in the Java Build path
>
> And BTW, it's weird because I can fairly use other Class and Methods in
> the mongo library jar. My application can persist and query the
> database, but without having a DTO with ObjectId.
>
> However, I really need to implement document id.
>

Hi Nat, yah, I figured that I am placing it to my gwt code.
I just used:

@Id
private String id;

Cheers.

Xybrek

unread,
Jan 18, 2012, 11:14:43 AM1/18/12
to public-mongodb-user-/...@plane.gmane.org

On 1/18/2012 9:13 PM, Nat wrote:

> Are you using gwt? Make sure that you don't expose it to gwt directly.
> -----Original Message-----
> From: Xybrek<xybrek-Re5JQEe...@public.gmane.org>
> Sender: mongodb-user-/JYPxA39Uh5...@public.gmane.org
> Date: Wed, 18 Jan 2012 20:57:28
> To:<mongodb-user-/JYPxA39Uh5...@public.gmane.org>
> Reply-To: mongodb-user-/JYPxA39Uh5...@public.gmane.org
> Subject: [mongodb-user] org.bson.types.ObjectId can not be found in source packages
>
> I'm getting this error for my java app:
>
> org.bson.types.ObjectId can not be found in source packages. Check
> the inheritance chain from your module; it may not be inheriting a
> required module or a module may not be adding its source path entries
> properly.
>
> I have `mongo-2.7.2.jar` in the Java Build path
>
> And BTW, it's weird because I can fairly use other Class and Methods in
> the mongo library jar. My application can persist and query the
> database, but without having a DTO with ObjectId.
>
> However, I really need to implement document id.
>

Hi Nat, yah, I figured that I am placing it to my gwt code.
I just used:

@Id
private String id;

I've read that its about the same effect that it will create a ObjectId
at the back-end mongodb database?

Cheers.

Nat

unread,
Jan 18, 2012, 11:27:08 AM1/18/12
to mongod...@googlegroups.com, public-mongodb-user-/...@plane.gmane.org

Xybrek

unread,
Jan 18, 2012, 12:33:17 PM1/18/12
to public-mongodb-user-/...@plane.gmane.org

On 1/19/2012 12:27 AM, Nat wrote:
> I assume you use Morphia?
> http://code.google.com/p/morphia/issues/detail?id=154
>

Yes I use Morphia, however, I don't

<inherits name='com.google.code.morphia.Morphia' />

in my GWT code. I think problem is that ObjectId is not "emulated".

So I had to resort to "String id" solution, which gave the same effect,
I check with my mongodb browser, and there it is a "_id"


Reply all
Reply to author
Forward
0 new messages