struts2.0+spring2.5+hibernate3.0整合小项目报错
请高手指教:最近学习SSH2框架搭建,用Myeclipse6.5环境,spring整合hibernate容易,但此基础上增加struts2时出错,不知如何解决,请高手指教!谢谢!struts.xml中:
<struts>
<!-- 设置Struts2默认的ObjectFactory为spring -->
<constant name="struts.objectFactory" value="spring" />
<!-- 设置Struts2应用是否处于开发模式,通常在开发调试阶段设为true,正式上线后可设为false -->
<constant name="struts.devMode" value="true" />
<constant name="struts.i18n.encoding" value="UTF-8" />
<package name="SSH3" extends="struts-default">
<action name="memberAction" class="action.MemberAction">
<result name="success">/page/suc.jsp</result>
<result name="fail">/page/fail.jsp</result>
</action>
</package>
</struts>
applicationContext.xml中:
<!-- 装配通用数据库访问类BaseDAOImpl-->
<bean id="baseDAO" class="DAOImpl.BaseDAOImpl">
<property name="sessionFactory" ref="sessionFactory">
</property>
</bean>
<bean id="memberBizTarget" class="BizImpl.MemberBizImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<bean id="memberBiz" parent="baseTransProxy">
<property name="target" ref="memberBizTarget"/>
</bean>
<!-- 配置struts的Action -->
<bean id="memberAction" class="action.MemberAction" scope="prototype">
<property name="memberBizDAO" ref="memberBizTarget"/>
</bean>
MemberAction类:
public class MemberAction extends ActionSupport{
private String name;
private String password;
private MemberBizDAO memberBizDAO;
public String execute(){
Member m=null;
int flag=0;
List l=this.getMemberBizDAO().listAllMember();
Iterator i=l.iterator();
while (i.hasNext()){
m=(Member)i.next();
if(m.getName().equals(this.getName())&&m.getPassword().equals(this.getPassword())){
flag=1;
break;
}
}
if(flag==1)
return "success";
else
return "fail";
}
出错问题:org.apache.jasper.JasperException: java.lang.ClassCastException: $Proxy15
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
若我不让MemberBizImpl 实现 MemberBizDAO接口就运行正常啊!
但运行显示:
javax.servlet.ServletException: Unable to instantiate Action, action.MemberAction, defined for 'memberAction' in namespace ''Error creating bean with name 'memberBizDAO': Bean definition is abstract - action - file:/D:/Apache%20Tomcat%206.0.18/webapps/SSH3/WEB-INF/classes/struts.xml:15:62
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
到底错误在哪里啊????
搜索更多相关主题的帖子:
项目
----------------解决方案--------------------------------------------------------
spring配置文件有问题
----------------解决方案--------------------------------------------------------