---
title: "struts2  convention-plugin"
author: "pure1202"
date: "2011-03-10T00:36:54Z"
tags: ["AOP", "Hibernate", "Java", "MySQL", "Oracle"]
categories: ["企业架构"]
slug: "struts2-convention-plugin"
draft: false
lastmod: "2011-03-10T01:25:46Z"
id: 949816
url: "https://aijof.iteye.com/blog/949816"
---

异常信息1：

```java

org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
	org.springframework.aop.framework.DefaultAopProxyFactory.createAopProxy(DefaultAopProxyFactory.java:67)
	org.springframework.aop.framework.ProxyCreatorSupport.createAopProxy(ProxyCreatorSupport.java:106)
	org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)

```

解决：

```java

由于CGLIB基于字节码的静态代理不能建立，缺少jar包：cglib-nodep-2.2.jar

```

--------------------------------------------------------------------
异常信息2:

```java

Caused by: org.hibernate.MappingException: could not instantiate id generator [entity-name=cn.aa.test.entity.User2]
	at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:132)
	at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:175)
。。。。。。
Caused by: org.hibernate.MappingException: Dialect does not support sequences
	at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:619)
	at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:88)
。。。。。。

```

解决：

```java

此处是用的mysql数据库，该表主键设置为auto_increment，
修改该对象主键生成策略名称为：
@GeneratedValue(strategy = GenerationType.IDENTITY)即可。

若数据库为oracle，则修改为@GeneratedValue(strategy = GenerationType.SEQUENCE)

```