Results 1 to 2 of 2

Thread: Problem while using transaction in spring frame work

  1. #1
    Join Date
    Aug 2004
    Location
    Bangalore,India
    Posts
    7

    Default Problem while using transaction in spring frame work

    hi,
    i got a problem in using spring db declarative transaction.when i put my dao class in transaction i am getting exception while starting the server as

    "org.springframework.beans.factory.BeanDefinitionS toreException: Error registering bean with name 'test' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Class that bean class [org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean] depends on not found; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice"

    my code is as below

    the buisiness class from where i will be calling my dao
    --------------------------------------------------------------

    public void setDataAccessObject(TestSpring tst) {
    this.ts = tst;
    }
    public boolean CreateRetirementDataObject(RetirementPlanBean rpb) {

    try {
    ts.myQuery();
    return true;
    } catch (Exception e) {
    return false;
    }
    }

    my dao method
    ---------

    public String myQuery() {
    String name = "";

    try {

    jt = new JdbcTemplate();

    jt.setDataSource(dataSource);
    name =
    (String) jt.queryForObject(
    "select name from retiredb where Id=1",
    java.lang.String.class);



    } catch (Exception ee) {



    }

    return name;

    }

    //setting data source
    public void setDataSource(DataSource dataSource) {
    this.dataSource = dataSource;
    }


    and my entries in xml files applicationContext.xml
    --------------------------------

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>WEB-INF/jdbc.properties</value>
    </list>
    </property>
    </bean>

    <bean id="retirementBusinessObject" class="beans.RetirementBusinessObject">
    <property name="dataAccessObject"><ref bean="testSpring"/></property>
    </bean>

    <bean id="test" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref bean="transactionManager"/></property>
    <property name="target"><ref local="retirementBusinessObject"/></property>
    <property name="transactionAttributes">
    <props>
    </props>
    </property>

    </bean>
    ----------------------------

    dataAcessContext-Local.xml
    ---------------------------------

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"><value>sun.jdbc.odbc.JdbcOd bcDriver</value></property>
    <property name="url"><value>jdbc:odbc:Retirement</value></property>
    </bean>


    <bean id="testSpring" class="beans.TestSpring">
    <property name="dataSource"><ref local="dataSource"/></property>

    </bean>


    <bean id="transactionManager" class="org.springframework.transaction.PlatformTra nsactionManager">
    <property name="dataSource"><ref local="dataSource"/></property>
    </bean>

  2. #2

    Default

    You need aopalliance.jar in you WEB-INF/lib directory. It is shipped with the Spring distribution.

Similar Threads

  1. Replies: 1
    Last Post: Mar 8th, 2005, 06:07 AM
  2. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  3. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  4. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM
  5. Replies: 1
    Last Post: Aug 19th, 2004, 12:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •