超难题.(struts1.2+spring+hibernate)
虚心求教,如有人能解决,十分感谢
2008-01-24 10:14:28,203 ERROR [org.apache.struts.action.RequestProcessor] - No action instance for path /Register could be created
java.lang.IllegalAccessException: Class org.apache.struts.util.RequestUtils can not access a member of class cn.hxex.order.action.RegisterAction with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:344)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
页面register.jsp代码
<html>
<head>
<title> JSP for RegisterForm form </title>
</head>
<body>
<html:form action="Register">
name : <html:text property="name" />
<html:errors property="name" />
<br />
password : <html:password property="password" />
<html:errors property="password" />
<br />
age : <html:text property="age" />
<html:errors property="age" />
<br />
e_mail : <html:text property="e_mail" />
<html:errors property="e_mail" />
<br />
<html:submit />
<html:cancel />
</html:form>
</body>
</html>
Struts.config.xml 配置
<form-beans>
<form-bean name="RegisterForm"
type="cn.hxex.order.forms.RegisterForm" />
</form-beans>
<action path="/Register"
type="cn.hxex.order.action.RegisterAction" name="RegisterForm"
input="/pages/register.jsp" scope="request">
<forward name="sucess" path="/pages/afterRegister.jsp" />
</action>
RegisterForm.java
package cn.hxex.order.forms;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import cn.hxex.order.bo.Register;
public class RegisterForm extends ActionForm {
private String password;
private String name;
private String age;
private String e_mail;
private Register register;
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getE_mail() {
return e_mail;
}
public void setE_mail(String e_mail) {
this.e_mail = e_mail;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Register getRegister() {
return register;
}
public void setRegister(Register register) {
this.register = register;
}
}
package cn.hxex.order.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import cn.hxex.order.bo.Register;
import cn.hxex.order.forms.RegisterForm;
public class RegisterAction extends BaseAction {
RegisterAction() {
super();
}
//public class RegisterAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
RegisterForm registerForm = (RegisterForm) form;
Register register = new Register();
register.setName(registerForm.getName());
register.setPassword(registerForm.getPassword());
register.setAge(registerForm.getAge());
register.setE_mail(registerForm.getE_mail());
getRegisterSerice().saveRegister(register);
registerForm.setRegister(register);
return mapping.findForward("sucess");
}
}
BaseAction.java
package cn.hxex.order.action;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.struts.ActionSupport;
import cn.hxex.order.service.IRegisterSerice;
/**
* Action基类 *
* @author galaxy */
public abstract class BaseAction extends ActionSupport {
protected Object getBean(String name) {
WebApplicationContext ctx = getWebApplicationContext();
return ctx.getBean(name);
}
protected IRegisterSerice getRegisterSerice() {
return (IRegisterSerice) getBean("registerSerice");
}
}
业务层接口IRegisterSerice.java
package cn.hxex.order.service;
import cn.hxex.order.bo.Register;
import cn.hxex.order.dao.IRegisterDAO;
public interface IRegisterSerice {
/**
* 保存注册用户
*
*/
public abstract Register saveRegister(Register register);
//定义接口实例
public abstract void setRegisterDAO(IRegisterDAO registerDAO);
}
接后面