classcastexception

Servlet Exception + Class Cast Exception + Glassfish + Netbeans + JPA Entities + Vaadin

帅比萌擦擦* 提交于 2019-12-10 17:01:49
问题 I get this error: StandardWrapperValve[Vaadin Servlet]: PWC1406: Servlet.service() for servlet Vaadin Servlet threw exception java.lang.ClassCastException: com.delhi.entities.Category cannot be cast to com.delhi.entities.Category when I try to run my webapps on glassfish v2. Category is a JPA entity object the offending code according to the server log is: for (Category c : categories) { mymethod(); } categories is derived from: List<Category> categories = q.getResultList(); Any idea what

java.lang.ClassCastException: android.app.ContextImpl

社会主义新天地 提交于 2019-12-10 15:36:28
问题 I am trying to incorporate ScoreNinja into my little game: http://scoreninja.appspot.com/ However, a runtime exception is thrown every time: 05-24 23:22:59.888: ERROR/AndroidRuntime(21237): FATAL EXCEPTION: main 05-24 23:22:59.888: ERROR/AndroidRuntime(21237): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shaq.pushcounter/com.shaq.pushcounter.ChickenPushupTimer}: java.lang.ClassCastException: android.app.ContextImpl 05-24 23:22:59.888: ERROR/AndroidRuntime(21237): at

Java exception “Exception in thread ”main“ java.lang.ClassCastException: [B cannot be cast to [I” when calling java.awt.image.BufferedImage.copyData()

江枫思渺然 提交于 2019-12-10 15:33:39
问题 In the following code, I'm trying to combine some 1024*1024 png into several larger pngs. The code fails with this exception: Exception in thread "main" java.lang.ClassCastException: [B cannot be cast to [I at sun.awt.image.IntegerInterleavedRaster.setDataElements(Unknown Source) at java.awt.image.BufferedImage.copyData(Unknown Source) at mloc.bs12.mapimagemerger.Merger.main(Merger.java:27) It's probably something small and silly which I overlooked, but I can't find anything wrong with the

Android ClassCastException upon retrieving Custom View

别说谁变了你拦得住时间么 提交于 2019-12-10 15:16:53
问题 I've just run into an issue when attempting to grab a custom View using findViewById(). The custom view otherwise displays and operates correctly. Unfortunately, I need to be able to change some data it displays at will, so it has to be done. My XML looks like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <com

Why doesn't TreeSet.contains() work?

拜拜、爱过 提交于 2019-12-10 13:49:23
问题 public class Empty { public static void main( String[] args ) { TreeSet<Class> classes = new TreeSet<Class>(); classes.add( String.class ); String test = new String(); try{ if( classes.contains(test.getClass()) ){ System.out.println( "contains" ); } }catch(ClassCastException cce){ System.out.println( "Expected: " + classes ); System.out.println( "But it was: " + test.getClass() ); } } } Why does this throw a ClassCastException ? 回答1: When instantiating TreeSet without an explicit comparator,

Communication between Signed Applet and server side Controller

删除回忆录丶 提交于 2019-12-10 11:54:19
问题 I have created a signed applet for uploading a file to server. Code is running fine but I want to send that file from applet to server side controller where the code has placed to save that file to server. My SendFile Code in signed Applet: public static void sendFile(String destFileName) throws IOException { String filePrivacy = "Public"; String fileKeyword = "uploadFileDocumentName"; String fileComments = "fileComments"; String fileType = "txt"; String fileFolder = "/Works"; String

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

给你一囗甜甜゛ 提交于 2019-12-10 11:13:45
问题 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

SEVERE: Exception springSecurityFilterChain… ClassCastException… DelegatingFilterProxy cannot be cast

旧巷老猫 提交于 2019-12-10 04:39:14
问题 can anyone help me resolve my tomcat run error, I get the following error when i run tomcat: SEVERE: Exception starting filter springSecurityFilterChain java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core

Hibernate 4 ClassCastException on LAZY loading while EAGER works fine

别说谁变了你拦得住时间么 提交于 2019-12-09 16:24:17
问题 I have the following JOINED inheritance root entity for geographic areas (like continents, countries, states etc.): @Entity @Table(name = "GeoAreas") @Inheritance(strategy = InheritanceType.JOINED) public abstract class GeoArea implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column protected Integer id; @Column protected String name; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id", referencedColumnName = "id") protected GeoArea parent; ...

ClassCastException in Java foreach loop

此生再无相见时 提交于 2019-12-08 20:02:06
问题 In what circumstances can ClassCastException occur in the code below: import java.util.Arrays; import java.util.List; public class Generics { static List getObjects() { return Arrays.asList(1, 2, 3); } public static void main(String[] args) { List<String> list = getObjects(); for (Object o : list) { // ClassCastException? System.out.println(o); } } } We had a similar case in a production environment (bad practice, I know) and the customer provided a log with ClassCastException at the line