我的系统采用的是struts1.3 + spring2.5 + hibernate 3.2
现在在配置文件新增了一个property tomcat 启动的时候报错
2009-7-14 17:54:14 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/indiBusiRegis' defined in file [C:\Tomcat 6.0\webapps\gszc\WEB-INF\classes\applicationContext-action.xml]: Cannot resolve reference to bean 'indiBusiRegisService' while setting bean property 'indiBusiRegisService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indiBusiRegisService' defined in file [C:\Tomcat 6.0\webapps\gszc\WEB-INF\classes\applicationContext-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indiBusiRegisService' defined in file [C:\Tomcat 6.0\webapps\gszc\WEB-INF\classes\applicationContext-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 42 more
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 51 more
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy18] to required type [com.trkj.DAO.TUserGthmcyhkbDAO] for property 'TUserGthmcyhkbDAO': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
... 55 more
2009-7-14 17:54:14 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-7-14 17:54:14 org.apache.catalina.core.StandardContext start
严重: Context [/gszc] startup failed due to previous errors
2009-7-14 17:54:14 org.apache.catalina.core.ApplicationContext log
不知道是什么原因引起的
[b]问题补充:[/b]
</bean>
这是applicationContext-beans.xml 里面的相关配置
[b]问题补充:[/b]
</bean>
这个是我最初的配置,为什么TUserGsjjgbDAO 不报错?只是添加了TUserGthmcyhkbDAO后就报错了
[b]问题补充:[/b]
这是 TUserGthmcyhkbDAO
public interface TUserGthmcyhkbDAO {
public void save(TUserGthmcyhkb transientInstance);
public void delete(TUserGthmcyhkb persistentInstance);
public TUserGthmcyhkb findById(java.lang.Integer id);
public List findByExample(TUserGthmcyhkb instance);
public List findByProperty(String propertyName, Object value);
public List findByGthlx(Object gthlx);
public List findBySfyd(Object sfyd);
public List findByDjdw(Object djdw);
public List findByZcdw(Object zcdw);
public List findByMclrxs(Object mclrxs);
public List findByXzqh(Object xzqh);
public List findBySh(Object sh);
public List findByHy(Object hy);
public List findByZzxs(Object zzxs);
public List findByGtgshmc(Object gtgshmc);
public List findBySqrxm(Object sqrxm);
public List findBySqrzjlx(Object sqrzjlx);
public List findBySqrzjhm(Object sqrzjhm);
public List findBySqrlxdh(Object sqrlxdh);
public List findBySqrtxdz(Object sqrtxdz);
public List findBySqryzbm(Object sqryzbm);
public List findByTjsqfs(Object tjsqfs);
public List findByZg(Object zg);
public List findByZydjsxsj(Object zydjsxsj);
public List findBySlryj(Object slryj);
public List findBySlzh(Object slzh);
public List findBySlzt(Object slzt);
public List findByZjse(Object zjse);
public List findByJycs(Object jycs);
public List findByLxdh(Object lxdh);
public List findByYwfw(Object ywfw);
public List findByScyj(Object scyj);
public List findByScr(Object scr);
public List findByJdyj(Object jdyj);
public List findByFzr(Object fzr);
public List findByLzrxm(Object lzrxm);
public List findByLzrzjlx(Object lzrzjlx);
public List findByLzrzjhm(Object lzrzjhm);
public List findByLzyjhsm(Object lzyjhsm);
public List findByCzy(Object czy);
public List findByCzyid(Object czyid);
public List findByZt(Object zt);
public List findAll();
public TUserGthmcyhkb merge(TUserGthmcyhkb detachedInstance);
public void attachDirty(TUserGthmcyhkb instance);
public void attachClean(TUserGthmcyhkb instance);
/**
* 名称登记查询
*/
public List findForMcdj(final String hzjg, final String tzwsh,
final String hnqymc, int sfmhcx);
}
这是 TUserGthmcyhkbDAOImpl
public class TUserGthmcyhkbDAOImpl extends HibernateDaoSupport implements TUserGthmcyhkbDAO {
private static final Log log = LogFactory.getLog(TUserGthmcyhkbDAOImpl.class);
// property constants
public static final String GTHLX = "gthlx";
public static final String SFYD = "sfyd";
public static final String DJDW = "djdw";
public static final String ZCDW = "zcdw";
public static final String MCLRXS = "mclrxs";
public static final String XZQH = "xzqh";
public static final String SH = "sh";
public static final String HY = "hy";
public static final String ZZXS = "zzxs";
public static final String GTGSHMC = "gtgshmc";
public static final String SQRXM = "sqrxm";
public static final String SQRZJLX = "sqrzjlx";
public static final String SQRZJHM = "sqrzjhm";
public static final String SQRLXDH = "sqrlxdh";
public static final String SQRTXDZ = "sqrtxdz";
public static final String SQRYZBM = "sqryzbm";
public static final String TJSQFS = "tjsqfs";
public static final String ZG = "zg";
public static final String ZYDJSXSJ = "zydjsxsj";
public static final String SLRYJ = "slryj";
public static final String SLZH = "slzh";
public static final String SLZT = "slzt";
public static final String ZJSE = "zjse";
public static final String JYCS = "jycs";
public static final String LXDH = "lxdh";
public static final String YWFW = "ywfw";
public static final String SCYJ = "scyj";
public static final String SCR = "scr";
public static final String JDYJ = "jdyj";
public static final String FZR = "fzr";
public static final String LZRXM = "lzrxm";
public static final String LZRZJLX = "lzrzjlx";
public static final String LZRZJHM = "lzrzjhm";
public static final String LZYJHSM = "lzyjhsm";
public static final String CZY = "czy";
public static final String CZYID = "czyid";
public static final String ZT = "zt";
protected void initDao() {
// do nothing
}
public void save(TUserGthmcyhkb transientInstance) {
log.debug("saving TUserGthmcyhkb instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(TUserGthmcyhkb persistentInstance) {
log.debug("deleting TUserGthmcyhkb instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public TUserGthmcyhkb findById(java.lang.Integer id) {
log.debug("getting TUserGthmcyhkb instance with id: " + id);
try {
TUserGthmcyhkb instance = (TUserGthmcyhkb) getHibernateTemplate()
.get("com.trkj.pojo.TUserGthmcyhkb", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(TUserGthmcyhkb instance) {
log.debug("finding TUserGthmcyhkb instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding TUserGthmcyhkb instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from TUserGthmcyhkb as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByGthlx(Object gthlx) {
return findByProperty(GTHLX, gthlx);
}
public List findBySfyd(Object sfyd) {
return findByProperty(SFYD, sfyd);
}
public List findByDjdw(Object djdw) {
return findByProperty(DJDW, djdw);
}
public List findByZcdw(Object zcdw) {
return findByProperty(ZCDW, zcdw);
}
public List findByMclrxs(Object mclrxs) {
return findByProperty(MCLRXS, mclrxs);
}
public List findByXzqh(Object xzqh) {
return findByProperty(XZQH, xzqh);
}
public List findBySh(Object sh) {
return findByProperty(SH, sh);
}
public List findByHy(Object hy) {
return findByProperty(HY, hy);
}
public List findByZzxs(Object zzxs) {
return findByProperty(ZZXS, zzxs);
}
public List findByGtgshmc(Object gtgshmc) {
return findByProperty(GTGSHMC, gtgshmc);
}
public List findBySqrxm(Object sqrxm) {
return findByProperty(SQRXM, sqrxm);
}
public List findBySqrzjlx(Object sqrzjlx) {
return findByProperty(SQRZJLX, sqrzjlx);
}
public List findBySqrzjhm(Object sqrzjhm) {
return findByProperty(SQRZJHM, sqrzjhm);
}
public List findBySqrlxdh(Object sqrlxdh) {
return findByProperty(SQRLXDH, sqrlxdh);
}
public List findBySqrtxdz(Object sqrtxdz) {
return findByProperty(SQRTXDZ, sqrtxdz);
}
public List findBySqryzbm(Object sqryzbm) {
return findByProperty(SQRYZBM, sqryzbm);
}
public List findByTjsqfs(Object tjsqfs) {
return findByProperty(TJSQFS, tjsqfs);
}
public List findByZg(Object zg) {
return findByProperty(ZG, zg);
}
public List findByZydjsxsj(Object zydjsxsj) {
return findByProperty(ZYDJSXSJ, zydjsxsj);
}
public List findBySlryj(Object slryj) {
return findByProperty(SLRYJ, slryj);
}
public List findBySlzh(Object slzh) {
return findByProperty(SLZH, slzh);
}
public List findBySlzt(Object slzt) {
return findByProperty(SLZT, slzt);
}
public List findByZjse(Object zjse) {
return findByProperty(ZJSE, zjse);
}
public List findByJycs(Object jycs) {
return findByProperty(JYCS, jycs);
}
public List findByLxdh(Object lxdh) {
return findByProperty(LXDH, lxdh);
}
public List findByYwfw(Object ywfw) {
return findByProperty(YWFW, ywfw);
}
public List findByScyj(Object scyj) {
return findByProperty(SCYJ, scyj);
}
public List findByScr(Object scr) {
return findByProperty(SCR, scr);
}
public List findByJdyj(Object jdyj) {
return findByProperty(JDYJ, jdyj);
}
public List findByFzr(Object fzr) {
return findByProperty(FZR, fzr);
}
public List findByLzrxm(Object lzrxm) {
return findByProperty(LZRXM, lzrxm);
}
public List findByLzrzjlx(Object lzrzjlx) {
return findByProperty(LZRZJLX, lzrzjlx);
}
public List findByLzrzjhm(Object lzrzjhm) {
return findByProperty(LZRZJHM, lzrzjhm);
}
public List findByLzyjhsm(Object lzyjhsm) {
return findByProperty(LZYJHSM, lzyjhsm);
}
public List findByCzy(Object czy) {
return findByProperty(CZY, czy);
}
public List findByCzyid(Object czyid) {
return findByProperty(CZYID, czyid);
}
public List findByZt(Object zt) {
return findByProperty(ZT, zt);
}
public List findAll() {
log.debug("finding all TUserGthmcyhkb instances");
try {
String queryString = "from TUserGthmcyhkb";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public TUserGthmcyhkb merge(TUserGthmcyhkb detachedInstance) {
log.debug("merging TUserGthmcyhkb instance");
try {
TUserGthmcyhkb result = (TUserGthmcyhkb) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(TUserGthmcyhkb instance) {
log.debug("attaching dirty TUserGthmcyhkb instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TUserGthmcyhkb instance) {
log.debug("attaching clean TUserGthmcyhkb instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public List findForMcdj(final String hzjg, final String tzwsh,
final String hnqymc, int sfmhcx) {
// TODO Auto-generated method stub
return this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
return session.createQuery("from TUserGthmcyhkb").setString(0, hzjg).setString(1,
tzwsh).setString(2, hnqymc).list();
}
});
}
public static TUserGthmcyhkbDAOImpl getFromApplicationContext(
ApplicationContext ctx) {
return (TUserGthmcyhkbDAOImpl) ctx.getBean("TUserGthmcyhkbDAO");
}
}
这两个分别是接口和实现类