[mongodb-user] java.lang.ClassCastException

24 views
Skip to first unread message

dgcombs

unread,
May 24, 2010, 5:31:17 PM5/24/10
to mongodb-user
I swear I didn't do it!
But here's the problem. I recompiled mongod using V8 rather than
SpiderMonkey. When I use the new version (I git'ed it from the
server), 1.5.2-pre- I get this error message on some JSP code that
used to just work:

java.lang.Boolean cannot be cast to java.lang.Number

Here's the code:
<%BasicDBObject doc = new BasicDBObject();
doc.put("src",171978757);
out.print(logs.find(doc).count());%>

Granted my little gray cells are a bit foggy after staying up late to
watch the final episode of LOST last night, but I'm unclear as to how
this is casting a Boolean.

Any insight would be helpful for either the Java exception or LOST.

--
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.

Eliot Horowitz

unread,
May 24, 2010, 5:33:18 PM5/24/10
to mongod...@googlegroups.com
1.5.2-pre- breaks all but 2.0rc1 of the java driver.
If you want bleeding edge on the db, you need bleeding edge on the driver.

dgcombs

unread,
May 24, 2010, 8:02:32 PM5/24/10
to mongodb-user
I see. That's probably good for *both* the Java problem and the Lost
finale. Thanks!

On May 24, 5:33 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> 1.5.2-pre- breaks all but 2.0rc1 of the java driver.
> If you want bleeding edge on the db, you need bleeding edge on the driver.
>
>
>
>
>
> On Mon, May 24, 2010 at 5:31 PM, dgcombs <dgco...@gmail.com> wrote:
> > I swear I didn't do it!
> > But here's the problem. I recompiled mongod using V8 rather than
> > SpiderMonkey. When I use the new version (I git'ed it from the
> > server), 1.5.2-pre- I get this error message on some JSP code that
> > used to just work:
>
> > java.lang.Boolean cannot be cast to java.lang.Number
>
> > Here's the code:
> >  <%BasicDBObject doc = new BasicDBObject();
> >                doc.put("src",171978757);
> >                out.print(logs.find(doc).count());%>
>
> > Granted my little gray cells are a bit foggy after staying up late to
> > watch the final episode of LOST last night, but I'm unclear as to how
> > this is casting a Boolean.
>
> > Any insight would be helpful for either the Java exception or LOST.
>
> > --
> > 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 athttp://groups.google.com/group/mongodb-user?hl=en.
>
> --
> 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 athttp://groups.google.com/group/mongodb-user?hl=en.

dgcombs

unread,
May 27, 2010, 12:28:59 PM5/27/10
to mongodb-user
Hmmm... sorry. I'm bleeding all over and it's still trying to convince
me that out.print(logs.getCount()); is casting a boolean to number.

Running:
db version v1.5.2-pre-, pdfile version 4.5 on the server and
mongo-2.0-rc3.jar as my connector.

Still looking for hints. Maybe under that big shiny thing sticking out
of the ground.

On May 24, 5:33 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:

> 1.5.2-pre- breaks all but 2.0rc1 of the java driver.
> If you want bleeding edge on the db, you need bleeding edge on the driver.
>
>
>
>
>
> On Mon, May 24, 2010 at 5:31 PM,dgcombs<dgco...@gmail.com> wrote:
> > I swear I didn't do it!
> > But here's the problem. I recompiled mongod using V8 rather than
> > SpiderMonkey. When I use the new version (I git'ed it from the
> > server), 1.5.2-pre- I get this error message on some JSP code that
> > used to just work:
>
> > java.lang.Boolean cannot be cast to java.lang.Number
>
> > Here's the code:
> >  <%BasicDBObject doc = new BasicDBObject();
> >                doc.put("src",171978757);
> >                out.print(logs.find(doc).count());%>
>
> > Granted my little gray cells are a bit foggy after staying up late to
> > watch the final episode of LOST last night, but I'm unclear as to how
> > this is casting a Boolean.
>
> > Any insight would be helpful for either the Java exception or LOST.
>
> > --
> > 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 athttp://groups.google.com/group/mongodb-user?hl=en.

Eliot Horowitz

unread,
May 27, 2010, 12:29:54 PM5/27/10
to mongod...@googlegroups.com
Do you have a stack trace?

dgcombs

unread,
May 27, 2010, 1:51:07 PM5/27/10
to mongodb-user
I dropped back and recompiled using 1.4.3 and it's working (albeit
slowly). I think the indexes may need to be updated after a little
flirtation with 1.5.x.

Dan

[show] java.lang.ClassCastException: java.lang.Boolean cannot be cast
to java.lang.Number

java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.Number
at com.mongodb.BasicDBObject.getInt(BasicDBObject.java:121)
at com.mongodb.DBCollection.getCount(DBCollection.java:472)
at com.mongodb.DBCollection.getCount(DBCollection.java:437)
at _jsp._secmetrics__jsp._jspService(secmetrics.jsp:79)
at _jsp._secmetrics__jsp._jspService(_secmetrics__jsp.java:41)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:535)
at
com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:
195)
at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:
183)
at
com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:
103)
at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:
286)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:
780)
at
com.caucho.server.connection.TcpConnection.dispatchRequest(TcpConnection.java:
600)
at
com.caucho.server.connection.TcpConnection.handleRequestsImpl(TcpConnection.java:
566)
at
com.caucho.server.connection.TcpConnection.handleRequests(TcpConnection.java:
519)
at com.caucho.server.connection.TcpConnection
$AcceptTask.doTask(TcpConnection.java:1100)
at com.caucho.server.connection.TcpConnection
$ConnectionReadTask.runThread(TcpConnection.java:1037)
at com.caucho.server.connection.TcpConnection
$AcceptTask.run(TcpConnection.java:1068)
at com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:
901)
at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866)

Eliot Horowitz

unread,
May 27, 2010, 1:52:41 PM5/27/10
to mongod...@googlegroups.com
That stack trace is not from a 2.0rcX jar
I don't think upgraded the mongo driver correctly.

Scott Hernandez

unread,
May 27, 2010, 1:56:47 PM5/27/10
to mongod...@googlegroups.com
We had a user with the same exception and it was a bug in their 1.5.x
server build. You might try a more recent 1.5.x build.

David Marko

unread,
May 27, 2010, 2:05:36 PM5/27/10
to mongodb-user
I had the problem with lastest MongoDB nightly build of 1.5.x branch.
When downgraded to 1.5.1 or 1.4.3., the problem disapeared.

David

On 27 kvě, 19:56, Scott Hernandez <scotthernan...@gmail.com> wrote:
> We had a user with the same exception and it was a bug in their 1.5.x
> server build. You might try a more recent 1.5.x build.
>
> On Thu, May 27, 2010 at 10:52 AM, Eliot Horowitz
>
>
>
> <eliothorow...@gmail.com> wrote:
> > That stack trace is not from a 2.0rcX jar
> > I don't think upgraded the mongo driver correctly.
>

Eliot Horowitz

unread,
May 27, 2010, 2:29:15 PM5/27/10
to mongod...@googlegroups.com
Have you made sure you really got new java driver?

David Marko

unread,
May 27, 2010, 2:36:04 PM5/27/10
to mongodb-user
No at all, I used 1.4 driver. I know about its incompatibility ... but
I use Morphia and it doesnt work 2.x driver

David

On 27 kvě, 20:29, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> Have you made sure you really got new java driver?
>

Eliot Horowitz

unread,
May 27, 2010, 2:40:05 PM5/27/10
to mongod...@googlegroups.com
Ah ok. 1.5.2 will require java 2.0 to work

>>>>> To post to this group, send email to mongodb-
>>>>> us...@googlegroups.com.

Scott Hernandez

unread,
May 27, 2010, 2:45:53 PM5/27/10
to mongod...@googlegroups.com
Yep, we have a working branch but no release until the driver is
stable (and released). I can easily put a test 2.0 driver snapshot of
morphia but nobody has asked yet; we haven't tested much yet.

I did notice that moving from rc1 -> rc3 failed some of our tests
relating to references; DBRef -> BSONObject cast failures in
DBCallback.objectDone(). I will probably look at this later today to
see if I can create a test case and maybe patch the driver.

Reply all
Reply to author
Forward
0 new messages