Announcement Announcement Module
No announcement yet.
Error creating bean .... AspectException: null Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean .... AspectException: null

    Hi everyone,

    I started with Spring framework a few weeks ago and I got stuck on the following error:

    Error creating bean with name 'myManager' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null

    This happened to me when I wanted to use the magical AOP and org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean class.

    It took me a very long time to find out what is wrong. 'null' is a very good hint indeed.

    Firstly I thought that I have found the same problem and also solution to that problem here: but I was already using the latest 1.1 release. Configuration used in topic 278 was very similar to mine except I like using constructors rather than properties and setters to initialise my beans.

    Only to provide some facts here is my application context:

    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" ""> 
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName"><value>org.hsqldb.jdbcDriver</value></property>
            <property name="url"><value>jdbc:hsqldb:SimpleBean</value></property>
            <property name="username"><value>sa</value></property>
            <property name="password"><value></value></property>
        <!-- Hibernate SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
            <property name="dataSource"><ref local="dataSource" /></property>
            <property name="mappingResources">
                <!-- Add list of .hbm.xml files here -->
            <property name="hibernateProperties">
                <prop key="hibernate.dialect">net.sf.hibernate.dialect.HSQLDialect</prop>
                <!-- Hibernate Connection Pool -->
                <prop key="hibernate.connection.pool_size">1</prop>
                <prop key="hibernate.dbcp.maxActive">4</prop>
                <prop key="hibernate.dbcp.whenExhaustedAction">1</prop>
                <prop key="hibernate.dbcp.maxWait">120000</prop>
                <prop key="hibernate.dbcp.maxIdle">10</prop>
                <!-- prepared statement cache --> 
                <prop key="">4</prop>
                <prop key="">1</prop>
                <prop key="">120000</prop>
                <prop key="">10</prop>
                <prop key="hibernate.connection.provider_class">net.sf.hibernate.connection.DBCPConnectionProvider</prop>
                <!-- Second-level Cache -->
                <prop key="hibernate.cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</prop>
                <prop key="hibernate.cache.use_minimal_puts">true</prop>
                <prop key="hibernate.cache.region_prefix">hibernate.test</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
        <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --> 
        <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
            <property name="sessionFactory"><ref local="sessionFactory" /></property>
        <!-- Add DAOs here --> 
        <bean id="hibernateDAO" class="SimpleDAO">
            <property name="sessionFactory"><ref local="sessionFactory" /></property>
        <!-- Add Managers Target Proxies here --> 
        <bean id="myManagerTarget" class="SimpleManager">
            <!--<property name="hibernateDao"><ref local="hibernateDAO" /></property>-->
    	    <ref bean="hibernateDAO"/>
        <!-- Add Managers Proxies here --> 
        <bean id="myManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager"><ref local="transactionManager" /></property> 
            <property name="target"><ref local="myManagerTarget" /></property> 
            <property name="transactionAttributes">
                <prop key="insert">PROPAGATION_REQUIRED</prop>
                <prop key="update">PROPAGATION_REQUIRED</prop>
                <prop key="delete">PROPAGATION_REQUIRED</prop>
                <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>

    Look at "myManagerTarget". If the SimpleManager class has not got a default public constructor
    public SimpleManager() {}
    but only this constructor is not enough!
    public SimpleManager(SimpleDAO dao)
      _dao = dao;
    funny thing is that a setter method does not have any impact on this. It does not have to be present.

    than you get "org.aopalliance.aop.AspectException: null"

    I am not sure if this is a feature or a defect although from my point of view it's a defect somewhere. Conclusion is that if such powerful frameworks works well then hurrah and if something goes wrong than you get stuck for hours if not for days (in this case).

    Am I the only one who had this problem? Or is this a very well documented feature and I am the last person on this planet who did not know?

    Last edited by robyn; May 14th, 2006, 10:08 AM.

  • #2
    I think this is the same erorr, which is fixed in Spring 1.1.1, just released yesterday:
    Last edited by robyn; May 14th, 2006, 10:09 AM.


    • #3
      Actually, I think you're hitting the limitation mentioned in this JIRA bug/feature request, which is still to be resolved (this week or next, as far as I can tell).


      • #4
        Thanks for you reply Colin.

        I just tried version 1.1.1 and it is still a problem.