Announcement Announcement Module
Collapse
No announcement yet.
Couldn't generate CGLIB subclass of class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Couldn't generate CGLIB subclass of class

    I am using Spring 2.0 with Hibernate 3.0 and JPA. I am also using annotations for JPA fields and Transactions. I am getting following error:
    org.springframework.aop.framework.AopConfigExcepti on: Couldn't generate CGLIB subclass of class [class com.amazon.otb.legacy.manage.MetaManager]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
    Caused by:
    java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
    at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhan cer.java:718)
    at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer .java:499)
    at net.sf.cglib.transform.TransformingClassGenerator. generateClass(TransformingClassGenerator.java:33)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:25)
    at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:216)
    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer. java:377)
    at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:2 85)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:202)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:147)



    It looks like Spring is trying to run my class MetaManager through CGLib even though I don't have any Transaction attributes defined for that class. Is there a way to disable CGLib for some beans. Thanks.

    Here is my spring configuration file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
    default-autowire="byName" default-lazy-init="true" >

    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="jpaVendorAdapter">
    <bean
    class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="showSql" value="true" />
    <property name="generateDdl" value="false" />
    <property name="databasePlatform" value="org.hibernate.dialect.Oracle9Dialect" />
    </bean>
    </property>
    <property name="loadTimeWeaver">
    <bean class="org.springframework.instrument.classloading .ReflectiveLoadTimeWeaver"/>
    </property>
    </bean>



    <!-- a PlatformTransactionManager is still required -->
    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:annotation-driven transaction-manager="txManager"/>


    <bean id="dataElementDao" class="com.amazon.otb.dao.hibernate.DataElementHib ernateDao"/>

    <bean id="dataPointDao" class="com.amazon.otb.dao.hibernate.DataPointHiber nateDao"/>

    <bean id="dataFrequencyDao" class="com.amazon.otb.dao.hibernate.DataFrequencyH ibernateDao"/>


    <bean id="planningLevelDao" class="com.amazon.otb.dao.hibernate.PlanningLevelH ibernateDao"/>

    <bean id="planningLevelManager" class="com.amazon.otb.service.impl.PlanningLevelMa nagerImpl">
    <constructor-arg>
    <ref bean="planningLevelDao"/>
    </constructor-arg>
    <property name="scenarioManager"><ref local="scenarioManager"/></property>
    </bean>

    ......

    Thanks.

  • #2
    In case of Hibernate JPA implementation, the loadTimeWeaver is not required.

    Comment

    Working...
    X