ssh报错: No property 'eBclass1EntityDao' found 高手求助!!

since66 2011-03-30 04:28:07
老是提示找不到 eBclass1EntityDao,我在Bclass1Service.java里添加了get和set都还是报错!请问是否漏了要注意的地方!搞了几天了!请高手帮下忙!
错误提示:
Error creating bean with name 'eBclass1EntityService' defined in ServletContext resource [/WEB-INF/applicationContext-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'eBclass1EntityDao' of bean class [com.kingstarit.M811project.service.basemgr.Bclass1Service]: No property 'eBclass1EntityDao' found
。。。。。
Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'eBclass1EntityDao' of bean class [com.kingstarit.M811project.service.basemgr.Bclass1Service]: No property 'eBclass1EntityDao' found

Bclass1Service代码:
public class Bclass1Service implements IBclass1Service, LocalBclass1Service {


private LocalBclass1Dao eBclass1EntityDao;

public Bclass1 getById(Long id) {
Bclass1 obj = eBclass1EntityDao.load(id);
return obj;
}

public PageData listResult(Map<String, Object> map, int targetPage, int pageSize) {
return eBclass1EntityDao.getListByParam(map, targetPage, pageSize);
}

public Bclass1 saveOrUpdate(Bclass1 entity) {
if ((entity.getId() == null) || (entity.getId().intValue() == 0)) {
eBclass1EntityDao.save(entity);
} else {
eBclass1EntityDao.update(entity);
}
return entity;
}

public boolean delete(Bclass1 entity) {
eBclass1EntityDao.delete(entity);
return true;
}

public boolean deleteEntitys(String ids) {

return true;
}

public LocalBclass1Dao getBclass1EntityDao() {
return eBclass1EntityDao;
}

public void setBclass1EntityDao(LocalBclass1Dao bclass1EntityDao) {
this.eBclass1EntityDao = bclass1EntityDao;
}
}


applicationContext-service.xml代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>

<bean id="eBclass1EntityService" class="com.kingstarit.M811project.service.basemgr.Bclass1Service">
<property name="eBclass1EntityDao">
<ref bean="eBclass1EntityDao" />
</property>
</bean>

<bean id="eBclass2EntityService"
class="com.kingstarit.M811project.service.basemgr.Bclass2Service">
<property name="eBclass2EntityDao">
<ref bean="eBclass2EntityDao" />
</property>
</bean>

<bean id="eBclass3EntityService" class="com.kingstarit.M811project.service.basemgr.Bclass3Service">
<property name="eBclass3EntityDao">
<ref bean="eBclass3EntityDao" />
</property>
</bean>

<bean id="eBcommentsEntityService" class="com.kingstarit.M811project.service.basemgr.BcommentsService">
<property name="eBcommentsEntityDao">
<ref bean="eBcommentsEntityDao" />
</property>
</bean>

<bean id="eBnemuEntityService"
class="com.kingstarit.M811project.service.basemgr.BnemuService">
<property name="eBnemuEntityDao">
<ref bean="eBnemuEntityDao" />
</property>
</bean>

<bean id="eBordersEntityService"
class="com.kingstarit.M811project.service.BordersService">
<property name="eBordersEntityDao">
<ref bean="eBordersEntityDao" />
</property>
</bean>

<bean id="eBprodetailsEntityService" class="com.kingstarit.M811project.service.BprodetailsService">
<property name="eBprodetailsEntityDao">
<ref bean="eBprodetailsEntityDao" />
</property>
</bean>

<bean id="eBuserEntityService" class="com.kingstarit.M811project.service.BuserService">
<property name="eBuserEntityDao">
<ref bean="eBuserEntityDao" />
</property>

</bean>


</beans>
...全文
151 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
qw4286874 2011-03-30
  • 打赏
  • 举报
回复
dao 没有配置。service配置应该配对应的实现吧。
lorry1113 2011-03-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 leewin27 的回复:]
引用 1 楼 emon123 的回复:

少了dao层的配置啊,eBclass1EntityDao,eBordersEntityDao,eBuserEntityDao等!不然你那ref bean找不到的!


+1
[/Quote]+1
kwj1111 2011-03-30
  • 打赏
  • 举报
回复
LocalBclass1Dao 没有在applicationContext-service.xml里面配置啊。
<bean id="LocalBclass1Dao" class="com.netpower.dao.LocalBclass1Dao(你的类路径)">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
leewin27 2011-03-30
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 emon123 的回复:]

少了dao层的配置啊,eBclass1EntityDao,eBordersEntityDao,eBuserEntityDao等!不然你那ref bean找不到的!
[/Quote]

+1
licip 2011-03-30
  • 打赏
  • 举报
回复
有一个问题你一定要注意: eBclass1EntityDao
作为属性,前面的两个字母不能一个小写一个大写。
像这种:eBclass1EntityDao
是不合要求的。你要写成:
ebclass1EntityDao
emon123 2011-03-30
  • 打赏
  • 举报
回复
少了dao层的配置啊,eBclass1EntityDao,eBordersEntityDao,eBuserEntityDao等!不然你那ref bean找不到的!
since66 2011-03-30
  • 打赏
  • 举报
回复
是的!少了个e,其实我蛮讨厌java的!做这个就是要细心~~!
qq282529017 2011-03-30
  • 打赏
  • 举报
回复
呵呵, 还真多啊!
w9527 2011-03-30
  • 打赏
  • 举报
回复
public void setBclass1EntityDao(LocalBclass1Dao bclass1EntityDao) {
this.eBclass1EntityDao = bclass1EntityDao;
}

很明显可以看见这个set就少了一个大写的e。而B变成开头了。你这样的话spring 在属性注入的时候是根据set注入的。这样很明显找不到这个set方法了。
w9527 2011-03-30
  • 打赏
  • 举报
回复
<bean id="eBclass1EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass1Dao"
parent="genericDao" />

<bean id="eBclass2EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass2Dao"
parent="genericDao" />

<bean id="eBclass3EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass3Dao"
parent="genericDao" />

<bean id="eBcommentsEntityDao" class="com.kingstarit.M811project.dao.basemgr.BcommentsDao"
parent="genericDao" />

<bean id="eBnemuEntityDao" class="com.kingstarit.M811project.dao.basemgr.BnemuDao"
parent="genericDao" />

<bean id="eBordersEntityDao" class="com.kingstarit.M811project.dao.basemgr.BordersDao"
parent="genericDao" />

<bean id="eBprodetailsEntityDao" class="com.kingstarit.M811project.dao.basemgr.BprodetailsDao"
parent="genericDao" />

<bean id="eBuserEntityDao" class="com.kingstarit.M811project.dao.basemgr.BuserDao"
parent="genericDao" />



你看看你定的id。然后你在看看你生成的get\set方法

如果你用的是eclipse 属性为is\e开头的都是有问题的。
since66 2011-03-30
  • 打赏
  • 举报
回复
回楼上
我是用eclipse自动生成的!这个setBclass1EntityDao方法有问题?
w9527 2011-03-30
  • 打赏
  • 举报
回复
public LocalBclass1Dao getBclass1EntityDao() {
return eBclass1EntityDao;
}

public void setBclass1EntityDao(LocalBclass1Dao bclass1EntityDao) {
this.eBclass1EntityDao = bclass1EntityDao;
}
}


spring是根据set来注入的。
since66 2011-03-30
  • 打赏
  • 举报
回复
回二楼的兄弟,代码是生成的!我没注意到!谢谢你的提醒!
since66 2011-03-30
  • 打赏
  • 举报
回复
回楼上各位兄弟,我已经配置了dao的mxl文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<!-- 根DAO -->
<bean id="genericDao" class="com.kingstarit.M811project.dao.generic.GenericDao">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<bean id="eBclass1EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass1Dao"
parent="genericDao" />

<bean id="eBclass2EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass2Dao"
parent="genericDao" />

<bean id="eBclass3EntityDao" class="com.kingstarit.M811project.dao.basemgr.Bclass3Dao"
parent="genericDao" />

<bean id="eBcommentsEntityDao" class="com.kingstarit.M811project.dao.basemgr.BcommentsDao"
parent="genericDao" />

<bean id="eBnemuEntityDao" class="com.kingstarit.M811project.dao.basemgr.BnemuDao"
parent="genericDao" />

<bean id="eBordersEntityDao" class="com.kingstarit.M811project.dao.basemgr.BordersDao"
parent="genericDao" />

<bean id="eBprodetailsEntityDao" class="com.kingstarit.M811project.dao.basemgr.BprodetailsDao"
parent="genericDao" />

<bean id="eBuserEntityDao" class="com.kingstarit.M811project.dao.basemgr.BuserDao"
parent="genericDao" />



</beans>

还有applicationContext-hibernate.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" dependency-check="none">
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:mysql://localhost:3306/shopdb</value>
<!--<value>jdbc:mysql://localhost:3306/projectinformation</value>-->
</property>
<property name="user">
<value>root</value>
<!--<value>root</value> -->
</property>
<property name="password">

<value>3262652</value>
<!--<value></value> -->

</property>
<property name="acquireIncrement">
<value>3</value>
</property>
<property name="initialPoolSize">
<value>3</value>
</property>
<property name="minPoolSize">
<value>2</value>
</property>
<property name="maxPoolSize">
<value>50</value>
</property>
<property name="maxIdleTime">
<value>600</value>
</property>
<property name="idleConnectionTestPeriod">
<value>900</value>
</property>
<property name="maxStatements">
<value>100</value>
</property>
<property name="numHelperThreads">
<value>10</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>

<value>com/kingstarit/M811project/entity/hbm/Bcomments.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Bprodetails.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Bclass2.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Bclass3.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Buser.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Borders.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Bnemu.hbm.xml</value>
<value>com/kingstarit/M811project/entity/hbm/Bclass1.hbm.xml</value>

</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">none</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.jdbc.batch_size">25</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">UTF-8</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器bean,使用HibernateTransactionManager事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<!-- 为事务管理器注入sessionFactory" -->
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 配置事务拦截器Bean -->
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 为事务拦截器bean注入一个事物管理器 -->
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<!-- 定义事务传播属性 -->
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="commit*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="change*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- 定义BeanNameAutoProxyCreator -->
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 指定满足哪些bean自动生成业务代理 -->
<property name="beanNames">
<!-- 需要自动创建事务代理的bean -->
<list>
<value>eBclass1EntityService</value>
<value>eBclass2EntityService</value>
<value>eBclass3EntityService</value>
<value>eBcommentsEntityService</value>
<value>eBnemuEntityService</value>
<value>eBordersEntityService</value>
<value>eBprodetailsEntityService</value>
<value>eBuserEntityService</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
<!-- 可增加其它的interceptor -->
</list>
</property>
</bean>
</beans>




81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧