最近写了一个增删改查的程序,是基于struts+spring的,用到spring的就是service向action里注入,Dao向service里注入,配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    
<beans>
  <!--  web layer -->
<bean name="/agencymanage/agencyManageAction"
  class="com.dhc.neo.agencymanage.action.agencyManageAction">
  <property name="agencyManageService" ref="agencyManageService" />
</bean><!-- service start -->
<bean id="agencyManageService" parent="baseTransactionProxyJdbcCRM">
  <property name="target">
   <bean
    class="com.dhc.neo.agencymanage.service.impl.agencyManageServiceImpl">
    <property name="agencyManageDao" ref="agencyManageDao" />
   </bean>
  </property>
</bean><!-- service end --><!-- dao start -->
<bean id="agencyManageDao"
  class="com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl">
  <property name="jdbcTemplate">
   <ref bean="jdbcTemplateCRM" />
  </property>
</bean>
<!-- dao end -->
</beans>添加后在启动tomcat服务器的时候报错
Cannot find class [com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl] for bean with name 'agencyManageDao' defined in ServletContext resource [/WEB-INF/xml/applicationContext-agencymanage.xml]; nested exception is java.lang.ClassNotFoundException: com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl
Caused by: 
java.lang.ClassNotFoundException: com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl
这是什么原因呀,求高手指点

解决方案 »

  1.   

    com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl哦 有可能是拼写错误吧
      

  2.   

    看看你的类名是否和文件中的完全一样,包括大小写。
    看看这个类是否在Classpath下面。
      

  3.   

    是大小写的问题路径中有几个地方没大写,我把它改过来了以后又报了错误,请大家帮忙看看。
    2010-12-05 09:15:53 [org.springframework.web.struts.ContextLoaderPlugIn]-[ERROR] Context initialization failed
     org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/agencymanage/agencyManageAction' defined in ServletContext resource [/WEB-INF/xml/applicationContext-agencymanage.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.dhc.neo.agencymanage.service.Impl.agencyManageServiceImpl$$EnhancerByCGLIB$$1e5a28f4] to required type [com.dhc.neo.agencymanage.service.agencyManageService] for property 'agencyManageService'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    Caused by: 
    org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
    PropertyAccessException 1:
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.dhc.neo.agencymanage.service.Impl.agencyManageServiceImpl$$EnhancerByCGLIB$$1e5a28f4] to required type [com.dhc.neo.agencymanage.service.agencyManageService] for property 'agencyManageService'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    Caused by: 
    java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    SEVERE: action: null
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/agencymanage/agencyManageAction' defined in ServletContext resource [/WEB-INF/xml/applicationContext-agencymanage.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.dhc.neo.agencymanage.service.Impl.agencyManageServiceImpl$$EnhancerByCGLIB$$1e5a28f4] to required type [com.dhc.neo.agencymanage.service.agencyManageService] for property 'agencyManageService'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
    PropertyAccessException 1:
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.dhc.neo.agencymanage.service.Impl.agencyManageServiceImpl$$EnhancerByCGLIB$$1e5a28f4] to required type [com.dhc.neo.agencymanage.service.agencyManageService] for property 'agencyManageService'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    Caused by: java.lang.IllegalArgumentException: No matching editors or conversion strategy found
      

  4.   

    spring的配置文件还是上面那几个,用的是spring依赖注入中的设值注入,还有,问一下,这个设值注入的set方法的位置还有什么要求吗?,比如说在所有方法的最后
      

  5.   

    是不是agencyManageServiceImpl没有实现agencyManageService接口啊
      

  6.   

    set方法的位置应该是没有问题的
      

  7.   

    实现了,如果不实现的话serviceimpl会报错
      

  8.   

    org.springframework.beans.PropertyBatchUpdateException  这个包在吗?是不是, 你在web.xml里面没有初始化啊  
      

  9.   

    找不到那个类com.dhc.neo.agencymanage.dao.impl.agencyManageDaoImpl你确定你有?或者你工程存在中文目录?
      

  10.   

    错误找到了,是其中的一个类名有点问题,所以没办法create()