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缺省为类添加无参构造方法这个动作.
也就是说当你为类添加构造方法后,你的类实际上就没有无参构造方法了,也就不支持反射机制了

时间: 2024-11-10 13:56:25

Could not create and/or set value back on to object .的相关文章

Object.create(): the New Way to Create Objects in JavaScript

There are a lot of ways to create Objects in JavaScript, perhaps even more to integrate inheritance into them. Just when you thought that you've seen every possible way to create JS objects, I'm here to announce that there's yet another: the new Obje

用Object.create来创建对象,及其兼容性写法

function inherit(p){ if(p==null){ throw TypeError(); } if(Object.create){ return Object.create(p); } var t=typeof p; if(t!=='object'&&t!=='function'){ throw TypeError(); } function f(){}; f.prototype=p; return new f(); } function range(from,to){ v

js Object.create 初探

1.作用 Object.create()方法创建一个新对象,使用现有的对象来提供新创建的对象的__proto__. https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/create 2.Object.create内部实现 Object.create = function (o) { var F = function () {}; F.prototype = o; retur

Threads Events QObjects

Events and the event loop Being an event-driven toolkit, events and event delivery play a central role in Qt architecture. In this article we'll not give a comprehensive coverage about this topic; we'll instead focus on some thread-related key concep

Oracle笔记 十二、PL/SQL 面向对象oop编程

------------------------抽象数据类型----------- --创建地址类型,一定要加as object,还可以在类型中加过程或方法 create or replace type address as object ( province varchar2(10), --省份属性 city varchar2(10) --市属性 ) not final; --not final表示该类型可以有子类型   --定义一个子类型 --under address说明这个类型继承至ad

Notification Centers 通知中心

Notification Centers 通知中心 A notification center manages the sending and receiving of notifications. It notifies all observers of notifications meeting specific criteria. The notification information is encapsulated in NSNotification objects. Client o

笔记:MyBatis XML配置详解

MyBatis 的配置文件包含了影响 MyBatis 行为甚深的设置(settings)和属性(properties)信息.文档的顶层结构如下: configuration 配置 properties 属性 settings 设置 typeAliases 类型命名 typeHandlers 类型处理器 objectFactory 对象工厂 plugins 插件 environments 环境 environment 环境变量 transactionManager 事务管理器 dataSource

swift分布式存储多节点部署

1.机器 192.168.1.211    Proxy Node 192.168.1.212    Storage Node 192.168.1.213    Storage Node 192.168.1.214    Storage Node 系统为SLES11sp1 2.配置软件源 因为公司服务器无法连外网,所以配置局域网源和本地源来搭建环境 上传ISO镜像文件到各台机器 SLES-11-SP4-DVD-x86_64-GM-DVD1.iso 每台机器挂载镜像,配置本地源 # mkdir /m

[Oracle]同义词(synonym)

(一)同义词的概念 同义词是数据库中表.视图.索引或其他模式对象的别名,与视图相似,同义词不占用实际的存储空间,在数据字典中只存同义词的定义. 在开发数据库时,应尽量避免直接引用表.视图或其他数据库对象,否则,当表的结构发生了改变,就会影响应用程序的使用,这个时候需要重新编译程序,如果为数据库对象创建了同义词,就可以在程序中使用同义词,这样表的结构发生变化,也不会影响到应用程序.此外,运用同义词还可以隐藏数据库对象名称以及对象所有者的信息,还可以简化对数据库对象的访问. (二)同义词分类 同义词