报这个错,只有一个原因,就是你转化的类型不对.

如果你的类是一个单实体类,也就是没有继承或是接口别的类.

public class HjmServiceImpl {}

那么这样写就可以:

HjmServiceImpl service = (HjmServiceImpl)ctx.getBean("HjmServiceImpl");

但如果你的类,一般像SERVER的实体类,是接口过的.

public class HjmServiceImpl implementsHjmExampleService{}

那么就一定要写成如下:

HjmExampleService service = (HjmExampleService)ctx.getBean("HjmServiceImpl");

看出区别没有.接口过父类的子类,在强制转换的时候,一定要用接口父类来定义.

java.lang.ClassCastException: sun.proxy.$Proxy11 cannot be cast to分析的更多相关文章

  1. java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView

    最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...

  2. 关于android使用ksoap2报Caused by: java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject

    Caused by: java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serializa ...

  3. java.lang.ClassCastException: oracle.sql.CLOB cannot be cast to oracle.sql.CLOB

    错误现象: [framework] 2016-05-26 11:34:53,590 -INFO  [http-bio-8080-exec-7] -1231863 -com.dhcc.base.db.D ...

  4. java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  5. 安卓出现错误: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  6. java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView

    今天遇到一个错误也不知道怎么回事,上网搜了一下: 出现的问题是:java.lang.ClassCastException:android.widget.Button cannot be cast to ...

  7. java.lang.ClassCastException: android.app.Application cannot be cast to

    出这个异常的原因是在项目中添加了新lication类(public class Application extends lication)之后,没有在AndroidManifest.xml中添加该类的 ...

  8. java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcStatement cannot be cast to java.beans.Statement

    当导入的包为:import java.sql.Statement;时,无任何错误 当导入的包为:import java.beans.Statement;时,出错

  9. Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView异常解决

    有时在修改xml文件时,全报这种错误,这个应该是缓存没得到及时更新导致的,可以通过以下方法解决: Eclipse tends to mess up your resources every now a ...

随机推荐

  1. 以前学习cisco ccna 课程的时候做的笔记

    由于学习的专业是计算机网络技术,可是在上学的时候,并没有学习到多少网络知识,所以为了对得起学的专业,在06年工作的时候,在哈工大银河教育报了个ccna的班,两个星期的课程,每天上那么几个小时. 结果依 ...

  2. PHP - 多文件上传

    <html> <head> <meta charset="utf-8"> <title>index_uploads</titl ...

  3. python变量传递给系统命令的方法

    python程序内执行shell命令可以有几种方式,在http://www.cnblogs.com/xuxm2007/archive/2011/01/17/1937220.html 里都有详细介绍. ...

  4. C# MVC 自学笔记—5 添加模型

    ==============================翻译============================== 在本节中,您将添加一些类来管理数据库中的电影.这些类将 ASP.NET M ...

  5. highcharts dynamic change line color

    mouseOut: function(){ this.series.graph.attr({"stroke","#ccc"}) }

  6. Codeforces Round #272 (Div. 2)AK报告

    A. Dreamoon and Stairs time limit per test 1 second memory limit per test 256 megabytes input standa ...

  7. JAVA多态学习3

    这一节我们来学习抽象类 抽象类–深入讨论 抽象类是java中一个比較重要的类. 1.用abstract关键字来修饰一个类时.这个类就是抽象类. 2.用abstract关键字来修饰一个方法时,这种方法就 ...

  8. HDU Wolf and Rabbit

    Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must h ...

  9. perl EXPORT模块

    Exporter - Implements default import method for modules 实现模块的默认导出方法: 简介: [tomcat@wx03 ~]$ cat hui.pm ...

  10. Libgdx实现异步加载网络图片并保存到SD卡或者data/data目录下边

    Libgdx实现异步加载网络图片并保存到SD卡或者data/data目录下边,当本地有图片的时候,直接从本地读取图片,如果本地没有图片,将从服务器异步加载图片 package com.example. ...