java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

Spring JIRA | Scott Cote | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    org.springframework.data.mongodb.core.mapreduce.MapReduceCounts appears to be typed incorrectly which causes MapReduceResults.parseCounts to fail. MapReduceCounts uses ints to store the output of the M/R result counts however the MongoDB server appears to return a long (see link and CPP code below). {code} Jan 13, 2012 11:14:13 PM org.apache.catalina.core.ApplicationContext log SEVERE: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.extjs.gxt.ui.client.data.PagingLoadResult com.ibbs.bbx.diagnostics.report.client.DocsisCapabilityService.getFilteredSubscriberModems(int,int,com.extjs.gxt.ui.client.data.FilterPagingLoadConfig)' threw an unexpected exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227) at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at org.springframework.data.mongodb.core.mapreduce.MapReduceResults.parseCounts(MapReduceResults.java:95) at org.springframework.data.mongodb.core.mapreduce.MapReduceResults.<init>(MapReduceResults.java:50) at org.springframework.data.mongodb.core.MongoTemplate.mapReduce(MongoTemplate.java:1026) at com.ibbs.unity.mongodb.services.ModemService.getDocsisCapByCmtsId(ModemService.java:241) at com.ibbs.bbx.diagnostics.report.server.DocsisCapabilityServiceImpl.getDocsisCapabilities(DocsisCapabilityServiceImpl.java:55) at com.ibbs.bbx.diagnostics.report.server.DocsisCapabilityServiceImpl.getFilteredSubscriberModems(DocsisCapabilityServiceImpl.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569) ... 19 more {code} Log output of the actual values: {code} INFO | jvm 1 | 2012/01/13 23:14:13 | input: 55668 class: java.lang.Long INFO | jvm 1 | 2012/01/13 23:14:13 | emit: 55668 class: java.lang.Long INFO | jvm 1 | 2012/01/13 23:14:13 | output: 52 class: java.lang.Long {code} Total number of documents in the collection being queried: 20,057,139 Relevant MongoDB source: https://github.com/mongodb/mongo/blob/master/src/mongo/db/commands/mr.cpp {code} 1036 long long num = 0; 1037 long long inReduce = 0; 1140 countsBuilder.appendNumber( "input" , num ); 1141 countsBuilder.appendNumber( "emit" , state.numEmits() ); 1162 long long finalCount = state.postProcessCollection(op, pm); state.appendResults( result ); timingBuilder.append( "total" , t.millis() ); result.append( "timeMillis" , t.millis() ); 1167 countsBuilder.appendNumber( "output" , finalCount ); {code}

    Spring JIRA | 5 years ago | Ben Hall
    com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.extjs.gxt.ui.client.data.PagingLoadResult com.ibbs.bbx.diagnostics.report.client.DocsisCapabilityService.getFilteredSubscriberModems(int,int,com.extjs.gxt.ui.client.data.FilterPagingLoadConfig)' threw an unexpected exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    org.springframework.data.mongodb.core.mapreduce.MapReduceCounts appears to be typed incorrectly which causes MapReduceResults.parseCounts to fail. MapReduceCounts uses ints to store the output of the M/R result counts however the MongoDB server appears to return a long (see link and CPP code below). {code} Jan 13, 2012 11:14:13 PM org.apache.catalina.core.ApplicationContext log SEVERE: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.extjs.gxt.ui.client.data.PagingLoadResult com.ibbs.bbx.diagnostics.report.client.DocsisCapabilityService.getFilteredSubscriberModems(int,int,com.extjs.gxt.ui.client.data.FilterPagingLoadConfig)' threw an unexpected exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227) at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at org.springframework.data.mongodb.core.mapreduce.MapReduceResults.parseCounts(MapReduceResults.java:95) at org.springframework.data.mongodb.core.mapreduce.MapReduceResults.<init>(MapReduceResults.java:50) at org.springframework.data.mongodb.core.MongoTemplate.mapReduce(MongoTemplate.java:1026) at com.ibbs.unity.mongodb.services.ModemService.getDocsisCapByCmtsId(ModemService.java:241) at com.ibbs.bbx.diagnostics.report.server.DocsisCapabilityServiceImpl.getDocsisCapabilities(DocsisCapabilityServiceImpl.java:55) at com.ibbs.bbx.diagnostics.report.server.DocsisCapabilityServiceImpl.getFilteredSubscriberModems(DocsisCapabilityServiceImpl.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569) ... 19 more {code} Log output of the actual values: {code} INFO | jvm 1 | 2012/01/13 23:14:13 | input: 55668 class: java.lang.Long INFO | jvm 1 | 2012/01/13 23:14:13 | emit: 55668 class: java.lang.Long INFO | jvm 1 | 2012/01/13 23:14:13 | output: 52 class: java.lang.Long {code} Total number of documents in the collection being queried: 20,057,139 Relevant MongoDB source: https://github.com/mongodb/mongo/blob/master/src/mongo/db/commands/mr.cpp {code} 1036 long long num = 0; 1037 long long inReduce = 0; 1140 countsBuilder.appendNumber( "input" , num ); 1141 countsBuilder.appendNumber( "emit" , state.numEmits() ); 1162 long long finalCount = state.postProcessCollection(op, pm); state.appendResults( result ); timingBuilder.append( "total" , t.millis() ); result.append( "timeMillis" , t.millis() ); 1167 countsBuilder.appendNumber( "output" , finalCount ); {code}

    Spring JIRA | 5 years ago | Ben Hall
    com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.extjs.gxt.ui.client.data.PagingLoadResult com.ibbs.bbx.diagnostics.report.client.DocsisCapabilityService.getFilteredSubscriberModems(int,int,com.extjs.gxt.ui.client.data.FilterPagingLoadConfig)' threw an unexpected exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
  4. 0

    Help:basic RMI question

    Google Groups | 2 decades ago | Paolo De Lutiis
    java.lang.ClassCastException: serverPackage.ServerClass_Stub at clientPackage.myApplet.init(myApplet.java:line#) at sun.applet.AppletPanel.run(AppletPanel.java:273) at java.lang.Thread.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.Integer cannot be cast to java.lang.Long

      at org.springframework.data.mongodb.core.mapreduce.MapReduceResults.parseTiming()
    2. Spring Data MongoDB - Core
      MongoTemplate.mapReduce
      1. org.springframework.data.mongodb.core.mapreduce.MapReduceResults.parseTiming(MapReduceResults.java:80)
      2. org.springframework.data.mongodb.core.mapreduce.MapReduceResults.<init>(MapReduceResults.java:49)
      3. org.springframework.data.mongodb.core.MongoTemplate.mapReduce(MongoTemplate.java:1026)
      3 frames
    3. com.mumbuku.util
      CategoryBrandDataLoader.run
      1. com.mumbuku.util.CategoryBrandDataLoader.defineAverageBrandCategoryPrice(CategoryBrandDataLoader.java:333)
      2. com.mumbuku.util.CategoryBrandDataLoader.run(CategoryBrandDataLoader.java:258)
      2 frames
    4. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:680)
      1 frame