classcastexception

ArrayList cannot be cast to Parcelable

北战南征 提交于 2019-12-06 17:23:46
问题 I get following Errors: Key com..BookStatus expected Parcelable but value was a ArrayList ClassCastException: ArrayList cannot be cast to Parcelable -> and therafter: Unable to start Activity - NullPointerException the ArrayList do have values of BookStatus Objects (listToPass) Key com.example.books.BookStatus expected Parcelable but value was a java.util.ArrayList. The default value was returned Attempt to cast generated internal exception: java.lang.ClassCastException: java.util.ArrayList

java.lang.ClassCastException while running new `runnableThread` in `Service` Class

China☆狼群 提交于 2019-12-06 10:53:06
问题 I have an application , contains a broadcastReceiver which listens to all new received SMS . If any new SMS received this BroadcastReceiver starts a background Service which runs GPS and return the coordinates , this coordinate retrieving needs a new thread to be run , in the Service class there is no getApplicationContext() so I used 'getContentBase()' for starting the new thread this is the code ((Activity)getBaseContext()).runOnUiThread(new Runnable() { ((Activity)getBaseContext())

ClassCastException Proxy36 cannot be cast to SessionImplementor after Hibernate/Spring 4 upgrade

此生再无相见时 提交于 2019-12-06 08:19:07
EDIT: I am not asking what a ClassCastException is. I am asking what is causing it in DetachedCriteria under this specific configuration of Spring 4/Hibernate 4. I'm trying to upgrade some legacy code to Spring 4/Hibernate 4 and I've hit a wall, as Google isn't turning up much. I am trying to run a JUnit test on a very simple Hibernate repository, and it is failing with java.lang.ClassCastException: com.sun.proxy.$Proxy36 cannot be cast to org.hibernate.engine.spi.SessionImplementor at org.hibernate.criterion.DetachedCriteria.getExecutableCriteria(DetachedCriteria.java:84) at com.my.app.rest

Cast List<Object[]> to Object[][] in Java

半腔热情 提交于 2019-12-06 06:31:09
问题 How to turn List of arrays into two dimensional array in Java? //Prepare the list List<Object[]> conf = new LinkedList<Object[]>(); conf.add(new Object[]{ "FOO", "BAR"}); conf.add(new Object[]{ "FOO", "BAR"}); I tried: Object[][] array = (Object[][]) conf.toArray(new Object[0]); But it fails at ClassCastException : java.lang.RuntimeException: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [[Ljava.lang.Object; 回答1: You are missing a pair of square brackets: Object[][]

Android LinkedHashMap deserializing as HashMap, causes CCE error

随声附和 提交于 2019-12-06 06:10:53
I'm attempting to pass a serialized LinkedHashMap between activities, and getting a confusing result/error when I deserialize the object. I serialize the object as follows: Bundle exDetails = new Bundle(); LinkedHashMap<String, Exercise> exMap = new LinkedHashMap<String, Exercise (workout.getExercises()); exDetails.putString(WORKOUTNAME, workout.getWorkoutName()); exDetails.putSerializable(workout.getWorkoutName(), exMap); iComplete.putExtra("wName", exDetails); startActivity(iComplete); That seems to work fine, the problem shows up in the next activity: Bundle exDetails = getIntent()

Eclipse ClassCastException when trying to expand XML layout for Android

隐身守侯 提交于 2019-12-06 04:07:49
问题 I am new to java, eclipse, and android development, so I may be missing something simple although I have checked basic stuff like spelling several times. Because there is no number picker control (such as that used in the date picker) in the public Android SDK, the conventional wisdom is to "clone and own" the control that exists in the Android source. In an attempt to do that, I have copied the code for NumberPicker into my project and its dependency, NumberPickerButton. I have also copied

Hibernate ClassCastException in GWT hosted mode only

前提是你 提交于 2019-12-06 03:35:57
问题 Hello and thanks for watching ;-) Our problem/error is: javax.persistence.PersistenceException: [PersistenceUnit: PUname] Unable to build EntityManagerFactory ... Caused by: org.hibernate.HibernateException: Could not instantiate dialect class ... Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQLDialect cannot be cast to org.hibernate.dialect.Dialect ... (see full stack trace at the bottom) It occurs in a GWT based web application using the following technologies: Maven

Java.lang.reflect.Proxy returning another proxy from invocation results in ClassCastException on assignment

时光毁灭记忆、已成空白 提交于 2019-12-05 22:26:59
问题 So I'm playing with geotools and I thought I'd proxy one of their data-access classes and trace how it was being used in their code. I coded up a dynamic proxy and wrapped a FeatureSource (interface) in it and off it went happily. Then I wanted to look at some of the transitive objects returned by the featureSource as well, since the main thing a FeatureSource does is return a FeatureCollection (FeatureSource is analogous to a sql DataSource and featurecollection to an sql statement). in my

UISelectMany in ui:repeat causes java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.List

萝らか妹 提交于 2019-12-05 18:50:11
I have used the HashMap method for binding a list of checkboxes to a Map<String, Boolean> with success. This is nice since it allows you to have a dynamic number of checkboxes. I'm trying to extend that to a variable length list of selectManyMenu . Being that they are selectMany, I'd like to be able to bind to a Map<String, List<MyObject>> . I have a single example working where I can bind a single selectManyMenu to a List<MyObject> and everything works fine, but whey I put a dynamic number of selectManyMenus inside a ui:repeat and attempt to bind to the map, I end up with weird results. The

java.lang.ClassCastException: android.os.BinderProxy cannot be cast to LocalBinder

不想你离开。 提交于 2019-12-05 17:16:06
问题 I have a Service that I am trying to bind to my main Activity , but I am receiving a java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.walintukai.rubix.ConnectionService$LocalBinder . I have declared the service in my manifest. Why is this happening? Manifest Declaration <service android:name=".ConnectionService" /> Service (simplified code) public class ConnectionService extends Service { static final String TAG = ConnectionService.class.getName(); private