Announcement Announcement Module
Collapse
No announcement yet.
Getting java.lang.ClassNotFoundException: org.aopalliance.aop.Advice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting java.lang.ClassNotFoundException: org.aopalliance.aop.Advice

    When using <tx:annotation-driven /> I am getting the above exception. Any ideas I am using Spring 3.0.4 and and here is my spring config

    <?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:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-3.0.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schem...g-util-3.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schem...ing-tx-3.0.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">


    <bean name="userDAO" class="sands.book.database.dao.UserDAO" />

    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="persistenceUnitName" value="perfSpring" />
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="showSql" value="false" />
    <property name="generateDdl" value="false" />
    <property name="database" value="MYSQL" />
    </bean>
    </property>
    </bean>

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost/netpay" />
    <property name="username" value="ddd" />
    <property name="password" value="ddd" />
    </bean>


    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    <property name="dataSource" ref="dataSource" />
    </bean>

    <bean class="org.springframework.orm.jpa.support.Persist enceAnnotationBeanPostProcessor"/>
    <tx:annotation-driven transaction-manager="transactionManager"/>

    </beans>

  • #2
    Search before posting... http://forum.springsource.org/showthread.php?t=82282

    Comment


    • #3
      Got that dependcy, but ...

      ... also had to add CGlib, now it complains about about org.objectweb.asm.Type

      is there any resource that lists all dependencies to speed up this trial and error game ;-)

      Comment


      • #4
        That resource is maven (or ivy)... Use maven to manage your dependencies instead of the trial and error game.

        Comment


        • #5
          Hibernate Spring Jar File Clash

          At the end it turned out that the problem was a clash between Hibernate libraries and the one's used by Spring leading to this strange behavior

          Comment


          • #6
            @Alois Can I get you to elaborate on what kind of clash you experienced and how you fixed it?

            I'm in the odd position where I have the aopalliance.jar included in my classpath, but it still complains about class not found.

            My problems started after I added tx:annotation-driven and defined a transactionManager bean.

            Here is my application-context

            Code:
            <?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:tx="http://www.springframework.org/schema/tx"
                   xmlns:aop="http://www.springframework.org/schema/aop"
                   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
            
            
                <tx:annotation-driven />
            
                <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                    <property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver" />
                    <property name="url" value="jdbc:derby://localhost:1527/sample" />
                    <property name="username" value="app" />
                    <property name="password" value="app" />
                </bean>
                
                <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                    <property name="dataSource" ref="dataSource" />
                    <property name="packagesToScan" value="dk.holbing.mediamanager.entity" />
                    <property name="hibernateProperties">
                        <props>
                            <prop key="dialect">org.hibernate.dialect.DerbyDialect</prop>
                        </props>
                    </property>
                </bean>
            
                 <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                    <property name="sessionFactory" ref="sessionFactory" />
                </bean>
            
            </beans>

            Comment

            Working...
            X