Spring - BeanCreationException or CGLIB2 when using @Transactional(readOnly = true)

If the instruction @Transactional(readOnly = true) is causing the bellow error(s):

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx' defined in class path resource [xxx/xxx.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.


Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.

fix it by adding the cglib jar, or if you use maven:

<dependency>
   <groupid>cglib</groupid>
   <artifactid>cglib</artifactid>
   <version>2.2</version>
</dependency>

Comments

Popular posts from this blog

Hibernate - HibernateException: createQuery is not valid without active transaction