解决方案 »

  1.   

    Constructor threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null是不是因为 
    <bean id ="ymUserQqDaoImpl" class="com.yanmad.data.dao.impl.YmUserQqDaoImpl" >
             <property name="sessionFactory" ref="sessionFactory"></property>
     </bean>只注入了一个属性!

    private SessionFactory sessionFactory;
     private YmUserQqDao ymUserQqDao;
    存在两个属性!
      

  2.   

    楼上讲的不错,搞不懂为什么要这个属性private YmUserQqDao ymUserQqDao;
    要不去掉setYmUserQqDao方法试试
      

  3.   

    @zxs6587 @wobuxiangnila  感谢两位的热心解答!
    我试着在impl中把set方法去掉后报
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ymUserQqDao' defined in class path resource [spring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.yanmad.data.dao.YmUserQqDao]: Specified class is an interface我的YmUserQqDao里什么啊:public interface YmUserQqDao extends IBaseDao<YmUserQq,Long>{}
    麻烦了!
      

  4.   

     [com.yanmad.data.dao.YmUserQqDao]: 是接口无法实例化!
    private YmUserQqDao ymUserQqDao;去掉行吗?
      

  5.   

     [com.yanmad.data.dao.YmUserQqDao]: 是接口无法实例化!
    private YmUserQqDao ymUserQqDao;去掉行吗?
    我在YmUserQqDaoImpl 把private YmUserQqDao ymUserQqDao 和他的set方法都去掉了 还是不行啊,报:Error creating bean with name 'ymUserQqDao' 
      

  6.   

    异常信息很明显了啊:
    Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.util.Assert.notNull(Assert.java:123)
    at com.yanmad.data.dao.impl.BaseHibernateDao.<init>(BaseHibernateDao.java:50)
    at com.yanmad.data.dao.impl.YmUserQqDaoImpl.<init>(YmUserQqDaoImpl.java:12)BaseHibernateDao.java:50的代码是什么!
      

  7.   

     [com.yanmad.data.dao.YmUserQqDao]: 是接口无法实例化!
    private YmUserQqDao ymUserQqDao;去掉行吗?
    我在YmUserQqDaoImpl 把private YmUserQqDao ymUserQqDao 和他的set方法都去掉了 还是不行啊,报:Error creating bean with name 'ymUserQqDao' 

    ymUserQqDao???都去掉之后哪里还有ymUserQqDao???哪里又报的这个错啊?不会是YmOtherLoginServiceImpl 这个类吧?
      

  8.   

    在YmOtherLoginServiceImpl 这个类中注入也有问题:属性名称为ymUserQqDao 
     private YmUserQqDao ymUserQqDao;   在注入属性名却是ymUserQqDaoImpl
    <bean id="ymOtherLoginServiceImpl" class="com.yanmad.xm.service.impl.YmOtherLoginServiceImpl">
            <property name="ymUserQqDaoImpl" ref="ymUserQqDaoImpl"></property> 
    </bean> 
    名称应该一致吧?报的那个Error creating bean with name 'ymUserQqDao' 错是指这里吗?还是其他地方?
     
       
      

  9.   

    层主说的有道理!BaseHibernateDao怎么写的啊?
      

  10.   

    感谢各位的热心解答,我找了下可能是我框架的问题。
    我把spring的包更新了下,hibernate换到了4然后在spring的配置文件里加了个packagesToScan就好了