Results 1 to 5 of 5

Thread: Dependency Mismatch Between Security and Core?

  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Question FIXED: Dependency Mismatch Between Security and Core?

    Hello everybody.

    I am working on an application which, additionally to Spring MVC uses Spring Security. I have recently tried to upgrade to the latest Spring versions (3.2.1 and 3.1.3). However, I have encountered the following problem:
    - Spring Security Core depends on Spring AOP
    - Spring AOP depends on Spring ASM
    - Spring Core doesn't depend on ASM as the needed parts from ASM are already packaged within the Spring Core (especially the ClassVisitor abstract class)
    - the application is packaged as a web archive (WAR)
    - in the lib folder, Maven copies both spring-core-3.2.1.RELEASE.jar and spring-asm-3.0.7.RELEASE.jar
    - the problem is that both of them contain different definitions for ClassVisitor (abstract class vs. interface)
    - when trying to deploy the application, I have:
    Code:
    Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
    Can anyone explain me how I can overcome this?

    Thanks in advance!

    Best regards,
    Daniel
    Last edited by danic; Feb 28th, 2013 at 06:24 AM. Reason: Added the FIXED marker.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Use the correct versions... Use dependency-management to enforce the 3.2 version (or exclude the old version from spring security).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2013
    Posts
    3

    Default

    Dear Marten,

    Thank you for your reply. I have tried forcing ASM to the latest version (3.1.4) with no result (same exception). I do not really understand what you mean by "correct versions". Is there an incompatibility between Security 3.1.3 and Core 3.2.1?

    Currently, my pom.xml contains:
    Code:
    	<properties>
    		<org.springframework.version>3.2.1.RELEASE</org.springframework.version>
    		<org.springframework.security.version>3.1.3.RELEASE</org.springframework.security.version>
    	</properties>
    
    	<dependencies>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>${org.springframework.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-core</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-config</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-web</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-taglibs</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    ...
    Best regards,
    Daniel

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    There is no asm for spring 3.2.x as those files are in core...

    No there is no mismatch but you have to manage yoru dependencies correctly... Currently you only have spring-webmvc as dpendency which would result in the other dependencies to come transative from spring-security.

    I tend to use the dependencyManagement tag to enforce the correct versions of the dependencies. You can use mvn dependency:tree to check which dependencies pulls in the asm jar and then exclude it.
    Last edited by Marten Deinum; Feb 28th, 2013 at 05:46 AM.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Feb 2013
    Posts
    3

    Default

    Thank you very much for your suggestions, Marten. They helped me understand and solve the problem.

    Here is the modified pom.xml (maybe this will help someone else as well) - I also had to force other dependencies (context, web, jdbc, tx) to the latest versions:
    Code:
    	<properties>
    		<org.springframework.version>3.2.1.RELEASE</org.springframework.version>
    		<org.springframework.security.version>3.1.3.RELEASE</org.springframework.security.version>
    	</properties>
    
    	<dependencies>
    		<dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-context</artifactId>
    		    <version>${org.springframework.version}</version>
    		</dependency>		
    
    		<dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-web</artifactId>
    		    <version>${org.springframework.version}</version>
    		</dependency>
    
    		<dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-jdbc</artifactId>
    		    <version>${org.springframework.version}</version>
    		</dependency>
    		
    		<dependency>
    		    <groupId>org.springframework</groupId>
    		    <artifactId>spring-tx</artifactId>
    		    <version>${org.springframework.version}</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>${org.springframework.version}</version>
    			<scope>compile</scope>
    		</dependency>
    		
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-core</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    			<exclusions>
    				<exclusion>
    					<groupId>org.springframework</groupId>
    					<artifactId>spring-asm</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-config</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-web</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-taglibs</artifactId>
    			<version>${org.springframework.security.version}</version>
    			<scope>compile</scope>
    		</dependency>
    ...
    Best regards,
    Daniel

Tags for this Thread

Posting Permissions

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