首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts,Spring,Hibernate中容易出错的基本有关问题

2012-11-06 
Struts,Spring,Hibernate中容易出错的基本问题???10.报错:org.apache.jasper.JasperException: $Proxy3 ca

Struts,Spring,Hibernate中容易出错的基本问题
?

?
?
10.报错:  org.apache.jasper.JasperException: $Proxy3 cannot be cast to             com.xj.service.impl.RoleService            java.lang.ClassCastException: $Proxy3 cannot be cast to com.xj.service.impl.RoleService    原因:很明显又是一个代理时候,强转错误:                         ServletContext context = servlet.getServletContext();          ApplicationContext app = (ApplicationContext) context.getAttribute            ?(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);                  IDeptService ds = (DeptService) app.getBean("deptservice");                  this.depList = ds.selectAllDeps();                  就是这段示例代码中的   IDeptService ds = (DeptService) app.getBean ("deptservice");出错了                 不能直接强转成接口的实现类,一定要转成接口.               IDeptService ds = (IDeptService) app.getBean("deptservice");        
?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

1 楼 avanry 2008-09-05   写的不错,最近正用ssh呢
支持一个,希望继续更新

热点排行