classcastexception

Hibernate ClassCastException in GWT hosted mode only

一个人想着一个人 提交于 2019-12-04 07:46:33
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 Hibernate EntityManager /JPA Guice GWT GWT-P GWT Maven Plugin ... The fact to stress is that it does work

ClassCastException when binding to local service from another Activity

天大地大妈咪最大 提交于 2019-12-04 05:20:16
问题 In my application I have two separated APKs. The Activity (A1) from the first APK starts local service and is able to call methods provided by this Service. Later the activity A1 starts another activity (A2) from the second APK. The A2 activity tries to connect to the local service started by A1. Both activities are running in the same process with the same SharedUserID. Service interface is provided as shown in API examples of LocalService. onBind method of service returns LocalBinder

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

时光怂恿深爱的人放手 提交于 2019-12-04 04:45:26
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 invocationhandler I just passed the call through to the underlying object, printing out the target class

How to cast two instance of the same loaded different classloader?

半腔热情 提交于 2019-12-04 03:14:37
I have two different webapps, and each load the same class A with different classloader. When I put one instance in the session and then get it from the other webapp, a ClassCastException is thrown. For example, in webapp A, I store a in the session, then in webapp B, I get the a from the session and cast it to A, the ClassCastException is thrown. Is there a way to resolve this? Is there a way to resolve this? Basically no. As far as the JLS is concerned, the types are different types, and there is no way that the JVM will allow you to pretend otherwise. For instance, the classes could have

How to detect ambiguous method calls that would cause a ClassCastException in Java 8?

笑着哭i 提交于 2019-12-04 02:31:55
We are currently in the process of migrating an application from Java 7 to Java 8. After fixing a some compilation issues, I stumbled upon an issue similar to the following question: ClassCast Error: Java 7 vs Java 8 . To summarise, here is a sample code that shows the issue: public class Test { public static void main(String[] args) { System.out.println(String.valueOf(getVal("xxx"))); // 7: prints the result, 8: Exception } @SuppressWarnings("unchecked") public static <T> T getVal(String param) { // do some computation based on param... return (T) result; // actual return type only depends on

How do you disable a button inside of an AlertDialog?

六月ゝ 毕业季﹏ 提交于 2019-12-03 13:27:16
问题 I am trying to write an AlertDialog with 3 buttons. I want the middle, Neutral Button to be disabled if a certain condition is not met. Code int playerint = settings.getPlayerInt(); int monsterint = settings.getMonsterInt(); AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setMessage("You have Encountered a Monster"); alertbox.setPositiveButton("Fight!", new DialogInterface.OnClickListener() { // do something when the button is clicked public void onClick(DialogInterface

How to convert ArrayList to String[] in java, Arraylist contains VO objects

我怕爱的太早我们不能终老 提交于 2019-12-03 11:24:29
Please help me to convert ArrayList to String[]. The ArrayList contains values of type Object(VO). For example, The problem is that I need to convert a country List to String Array, sort it and then put it in a list. However I am getting a ClassCastException. String [] countriesArray = countryList.toArray(new String[countryList.size()]); I have assumed that your country List name is countryList . So to convert ArrayList of any class into array use following code. Convert T into the class whose arrays you want to create. List<T> list = new ArrayList<T>(); T [] countries = list.toArray(new T

java.lang.ClassCastException: com.sun.faces.facelets.compiler.UIInstructions cannot be cast to org.primefaces.model.menu.MenuElement

心不动则不痛 提交于 2019-12-03 08:03:58
问题 This morning I came in to my office and the first thing I saw: my company site crashed. Because of me I think. Now I tried for one hour and a half to fix this, but I found nothing and everybody looses their mind because the website doesn't work and I can't fix it (i'm alone. The creators of the site are gone or in holidays). So I hope you can help me out! I get this exception, when I call the dashboard.xhtml of my website. java.lang.ClassCastException: com.sun.faces.facelets.compiler

How do you disable a button inside of an AlertDialog?

谁说胖子不能爱 提交于 2019-12-03 06:16:52
I am trying to write an AlertDialog with 3 buttons. I want the middle, Neutral Button to be disabled if a certain condition is not met. Code int playerint = settings.getPlayerInt(); int monsterint = settings.getMonsterInt(); AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setMessage("You have Encountered a Monster"); alertbox.setPositiveButton("Fight!", new DialogInterface.OnClickListener() { // do something when the button is clicked public void onClick(DialogInterface arg0, int arg1) { createMonster(); fight(); } }); alertbox.setNeutralButton("Try to Outwit", new

No ClassCastException when casting to generic type different to actual class [duplicate]

纵饮孤独 提交于 2019-12-03 05:45:21
This question already has an answer here: Casting to generic type in Java doesn't raise ClassCastException? 5 answers I have some code which looks something like this (part of a negative test of the method get ): import java.util.*; public class Test { Map<String, Object> map = new HashMap<>(); public static void main (String ... args) { Test test = new Test(); test.put("test", "value"); // Store a String System.out.println("Test: " + test.get("test", Double.class)); // Retrieve it as a Double } public <T> T get(String key, Class<T> clazz) { return (T) map.get(key); } public void put(String