struts2 convention-plugin

異常信息1:

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)

解決:

由於CGLIB基於字節碼的靜態代理不能建立,缺少jar包:cglib-nodep-2.2.jar

--------------------------------------------------------------------
異常信息2:

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)
。。。。。。

解決:

此處是用的mysql數據庫,該表主鍵設置爲auto_increment,
修改該對象主鍵生成策略名稱爲:
@GeneratedValue(strategy = GenerationType.IDENTITY)即可。

若數據庫爲oracle,則修改爲@GeneratedValue(strategy = GenerationType.SEQUENCE)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章