zoukankan      html  css  js  c++  java
  • Could not create and/or set value back on to object .

    严重: Error building bean
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cn.it.shop.model.Category': Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: : No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {
    }

    严重: Could not create and/or set value back on to object
    java.lang.InstantiationException: cn.it.shop.model.Category
    at java.lang.Class.newInstance(Class.java:359)
    at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:158)
    at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:204)
    at com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.createObject(InstantiatingNullHandler.java:163)

    严重: Exception occurred during processing request: attempt to create saveOrUpdate event with null entity
    java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity
    at org.hibernate.event.spi.SaveOrUpdateEvent.<init>(SaveOrUpdateEvent.java:62)
    at org.hibernate.event.spi.SaveOrUpdateEvent.<init>(SaveOrUpdateEvent.java:45)
    at org.hibernate.internal.SessionImpl.update(SessionImpl.java:731)
    at org.hibernate.internal.SessionImpl.update(SessionImpl.java:726)
    at cn.it.shop.service.impl.CategoryServiceImpl.update(CategoryServiceImpl.java:46)

    • 原因:

    struts2的model driven机制采用了反射机制
    反射机制要求用户类必须要有无参构造方法
    当一个类没有构造方法时,java缺省为其加一个无参构造方法
    当你为一个类添加构造方法时,实际上就禁掉了java缺省为类添加无参构造方法这个动作.
    也就是说当你为类添加构造方法后,你的类实际上就没有无参构造方法了,也就不支持反射机制了

  • 相关阅读:
    Sitecore 9 为什么数据驱动的组织选择它
    Sitecore 个性化
    Sitecore 9 您应该了解的所有新功能和变化
    Sitecore客户体验成熟度模型之旅
    Sitecore 8.2 工作流程
    sitecore-多变量测试与A / B测试概念论述
    sitecore
    cesium1.65api版本贴地贴模型标绘工具效果(附源码下载)
    leaflet结合geoserver利用WFS服务实现图层新增功能(附源码下载)
    openlayers6实现webgl点图层渲染效果(附源码下载)
  • 原文地址:https://www.cnblogs.com/shanheyongmu/p/5776141.html
Copyright © 2011-2022 走看看