今天使用Struts1.x + Hibernate3.2集成的时候出了个以下错误:No bean specified
不能保存外键!!!!找不到相对应得formbean!但是formbean中有对应得类!
EmployeeForm类
private Employee employee = new Employee(); public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } |
public class Employee implements java.io.Serializable { // Fields private Integer empno;private Dept dept = new Dept(); //随后发现问题出在这里,此处没有实例化 private String username; private String realname; private String pass; private Date createdate; private Integer isdel; //省略setter/getter方法 |
Hibernate: select dept0_.deptno as deptno0_, dept0_.dname as dname0_, dept0_.isdel as isdel0_ from FinancialDB.dbo.dept dept0_ where dept0_.isdel = 0
2011-11-28 22:52:57 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet action threw exception java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xiaolong.filter.HibernateFilter.doFilter(HibernateFilter.java:32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xiaolong.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)