java.lang.ClassCastException: sun.proxy.$Proxy11 cannot be cast to分析
报这个错,只有一个原因,就是你转化的类型不对.
如果你的类是一个单实体类,也就是没有继承或是接口别的类.
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分析的更多相关文章
- java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...
- 关于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 ...
- 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 ...
- 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 ...
- 安卓出现错误: 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 ...
- java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView
今天遇到一个错误也不知道怎么回事,上网搜了一下: 出现的问题是:java.lang.ClassCastException:android.widget.Button cannot be cast to ...
- java.lang.ClassCastException: android.app.Application cannot be cast to
出这个异常的原因是在项目中添加了新lication类(public class Application extends lication)之后,没有在AndroidManifest.xml中添加该类的 ...
- java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcStatement cannot be cast to java.beans.Statement
当导入的包为:import java.sql.Statement;时,无任何错误 当导入的包为:import java.beans.Statement;时,出错
- 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 ...
随机推荐
- 关于 Swift
摘自:http://numbbbbb.gitbooks.io/-the-swift-programming-language-/chapter1/01_swift.html Swift 是一种新的编程 ...
- AlphaMobileControls介绍
大家在开发wince程序或者windows mobile程序时还在为丑陋的界面着急吗?AlphaMobileControls可以帮你解决这些方案.当然如果你是高手可以自己去实现一些特殊的功能,自己定义 ...
- 实战 iTextSharp
原文 实战 iTextSharp iTextSharp 是用来生成 PDF 的一个组件,在 1998 年夏天的时候,Bruno Lowagie ,iText 的创作者,参与了学校的一个项目,当时使用 ...
- 基于visual Studio2013解决C语言竞赛题之0608水仙花函数
题目 解决代码及点评 /* 功能:写一函数判断某数是否"水仙花数",所谓"水仙花数"是指一个三位数, 其各位数字立方和等于该数本身. */ #includ ...
- iphone分辨率终极指南(含有iphone6/6+)
如文本不清楚.请 "对->图片另存为" 下载大图后, ------------------------- 原文及翻译文本 Points点 At the beginning, ...
- WPF DataGrid 增加"更新"模板列,根据行Row的选择而显示"更新"按钮
SelectionMode="Single" <DataGridTemplateColumn Header=""> <DataGridTemp ...
- 获取wpf datagrid当前被编辑单元格的内容
原文 获取wpf datagrid当前被编辑单元格的内容 确认修改单元个的值, 使用到datagrid的两个事件 开始编辑事件 BeginningEdit="dataGrid_Beginni ...
- 基于visual Studio2013解决面试题之1004最长等差数列
题目
- 基于visual Studio2013解决C语言竞赛题之1025Bessel函数
题目 解决代码及点评 /* 功能:25. Bessel函数Jn(X)有以下的递推关系: J[n+1](x)=(2n+1)/x*J[n](x)-J[n-1](x) 并 ...
- HDU 1599 find the mincost route (无向图floyd最小环详解)
转载请注明出处:http://blog.csdn.net/a1dark 分析:终于弄懂了floyd的原理.以前的理解一直肤浅.所以一做到floyd应用的题.就拙计了.其实floyd的本质DP.利用前K ...