Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Spring 2.0 AOP: ASM Dependencies

  1. #1
    Join Date
    Sep 2004
    Location
    Texas
    Posts
    155

    Default Spring 2.0 AOP: ASM Dependencies

    I am trying to run Spring 2.0RC2 with Hibernate 3.1.3. Spring uses one set of the .ASM jars:

    asm-2.2.2.jar
    asm-commons-2.2.2.jar
    asm-util-2.2.2.jar

    while Hibernate uses its own set (lacking version numbers):

    asm.jar
    asm-attrs.jar

    I attempted to execute the simple test that Rod published here:

    http://forum.springframework.org/sho...71&postcount=2

    The test fails on the call to:

    proxyFactory.addAspect( aspect );


    If I have only the Spring ASM dependencies in my classpath, I fail with:

    java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor

    (CodeVisitor is a class found in the Hibernate ASM jar)

    If I have only the Hibernate ASM dependencies in my class path, I fail with:

    java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor

    If I put both sets of dependencies in my classpath, I fail with:

    java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/StringV

    How should I be setting this up?

    Corby

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    try using asm and asm-common latest versions. (We try to use the latests jar in our with-dist jar and be as compatible as we can but we can't cover every case).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Sep 2004
    Location
    Texas
    Posts
    155

    Default

    OK, I removed all other versions of ASM, and put asm-3.0_RC1.jar and asm-commons-3.0_RC1.jar in my classpath. Now, I get the following error:

    java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at net.sf.cglib.core.DebuggingClassWriter.<init>(Debu ggingClassWriter.java:47)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClas sWriter(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyF actory.java:145)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:117)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:108)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:104)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java :69)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at org.springframework.aop.framework.DefaultAopProxyF actory.<clinit>(DefaultAopProxyFactory.java:57)
    Corby

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Try this - use cglib_nodep jar instead of simple cglib - the jar includes the required asm dependencies so it will not require any asm jar inside the classpath.
    If you still require asm (for some other library) then try using the latest stable/production release - 2.2.2 or 2.2.3 I think. There is an asm-all.jar which includes all asm packages.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  5. #5
    Join Date
    Sep 2004
    Location
    Texas
    Posts
    155

    Default

    Quote Originally Posted by Costin Leau
    Try this - use cglib_nodep jar instead of simple cglib - the jar includes the required asm dependencies so it will not require any asm jar inside the classpath.
    Thanks, I will give it a try. To be honest, though, I am very confused as to why it would be using cglib at all here. I am running Java5, and the proxied class Rod defines has an interface, so I would have expected that it would simply build JDK proxies here.
    Corby

  6. #6
    Join Date
    Sep 2004
    Location
    Texas
    Posts
    155

    Default

    Thanks, asm-all-2.2.3.jar worked great.
    Corby

  7. #7
    Join Date
    Jan 2007
    Location
    Mexico City
    Posts
    8

    Default Spring 2.0 AOP: ASM Dependencies

    Thks a lot!!!
    I read this thread and works to me too!!!

    I use this:
    aspectjweaver 1.5.2a
    asm-all 2.2.3
    cglib-nodep 2.1_3

    Also in Hibernate dependencies, I had to exclude the next:
    asm 1.5.3
    asm-attrs 1.5.3

    Note: I work with maven2 to do this...

    Thks to all...

  8. #8
    Join Date
    Oct 2007
    Location
    Berlin - Germany
    Posts
    6

    Default

    See posting ASM version incompatibilities, using Spring @Autowired with Hibernate related to this thread.

    If you use maven add this to your pom.xml:

    Code:
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>3.2.2.ga</version>
      <exclusions>
        <exclusion>
          <groupId>asm</groupId>
          <artifactId>asm</artifactId>
        </exclusion>
        <exclusion>
          <groupId>asm</groupId>
          <artifactId>asm-attrs</artifactId>
        </exclusion>
        <exclusion>
          <groupId>cglib</groupId>
          <artifactId>cglib</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm</artifactId>
      <version>2.2.3</version>                       
    </dependency>
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib-nodep</artifactId>
      <version>2.1_3</version>
    </dependency>
    Now asm-2.2.3 is used and cglib-nodep for hibernate. cglib-nodep uses its own asm classes.
    ...and remember: code is poetry

  9. #9
    Join Date
    Jan 2007
    Location
    Mexico City
    Posts
    8

    Default Cool!!!

    Thks a lot!!!
    With the exclusions and the other dependencies it's working, but to be sure I have to delete some jars in my repo because I feel some wrong at the moment of the package, I have to delete the old versions of CGLIB and ASM...

    And now with the new release 2.5RC1, that problem is solved, we have to test it that!!!

    Thks for your support!!!

  10. #10
    Join Date
    Nov 2007
    Posts
    10

    Default Still a conflict

    Hi, I just tried to get rid of the asm problem using the above exclusions but it does not work. I still get the following exception.

    Code:
    INFO - AbstractApplicationContext.obtainFreshBeanFactory(393) - 
    ........
    AbstractApplicationContext$BeanPostProcessorChecker.postProcessAfterInitialization(1006)
    I can see asm1.5.3 is downloaded every time I build the project if I remove it from the repository.
    Except for the <artifactId>hibernate</artifactId> I have other hibernate dependencies that should not use ASM.

    In eclipse the exception goes away after I ajust the classpath, e.g. put HIBERNATE CORE after SpRING AOP.

    My pom.xml file is

    Code:
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-support</artifactId>
    			<version>2.0.6</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-agent</artifactId>
    			<version>2.0.6</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-aop</artifactId>
    			<version>2.0.6</version>
    		</dependency>
    
    		<dependency>
    			<groupId>asm</groupId>
    			<artifactId>asm</artifactId>
    			<version>2.2.3</version>
    		</dependency>
    		<dependency>
    			<groupId>asm</groupId>
    			<artifactId>asm-commons</artifactId>
    			<version>2.2.3</version>
    		</dependency>
    		<dependency>
    			<groupId>aspectj</groupId>
    			<artifactId>aspectjrt</artifactId>
    			<version>1.5.3</version>
    		</dependency>
    		<dependency>
    			<groupId>aspectj</groupId>
    			<artifactId>aspectjweaver</artifactId>
    			<version>1.5.3</version>
    		</dependency>
    
    		<dependency>
    			<groupId>cglib</groupId>
    			<artifactId>cglib-nodep</artifactId>
    			<version>2.1_3</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-dao</artifactId>
    			<version>2.0.7</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-hibernate3</artifactId>
    			<version>2.0.7</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-jpa</artifactId>
    			<version>2.0.7</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-orm</artifactId>
    			<version>1.2-rc2</version>
    		</dependency>
    
    
    
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate</artifactId>
    			<version>3.2.2.ga</version>
    			<exclusions>
    				<exclusion>
    					<groupId>asm</groupId>
    					<artifactId>asm</artifactId>
    				</exclusion>
    				<exclusion>
    					<groupId>asm</groupId>
    					<artifactId>asm-attrs</artifactId> 
    				</exclusion>
    				<exclusion>
    					<groupId>cglib</groupId>
    					<artifactId>cglib</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
     
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-entitymanager</artifactId>
    			<version>3.3.1.ga</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-validator</artifactId>
    			<version>3.0.0.ga</version>
    		</dependency>
    
    		<dependency>
    			<groupId>javax.persistence</groupId>
    			<artifactId>persistence-api</artifactId>
    			<version>1.0</version>
    		</dependency>
    Thank you

Posting Permissions

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