java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

Why java.lang.IncompatibleClassChangeError Exception Thrown?

If you are working with Spring MVC and Spring Data Neo4j, then there is greater possibility that you would get the following exception when it comes to run the application using one of the Java EE container like Apache. I’ve used Apache Tomcat 7.35 for deploying a PrimeFaces 5 application with Spring MVC & Spring Neo4j using the following maven pom file. Note that, this exception could be thrown for some other frameworks as well.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>next.javabeat.jsf</groupId>
	<artifactId>JavaBeat-Primefaces-SpringData-Neo4j</artifactId>
	<packaging>war</packaging>
	<version>1.0</version>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.7</java.version>
		<junit.version>4.9</junit.version>
		<slf4j.version>1.6.4</slf4j.version>
		<logback.version>1.0.1</logback.version>
		<log4j.version>1.2.14</log4j.version>

		<servlet.version>2.5</servlet.version>
		<jsp.version>2.1</jsp.version>
		<jstl.version>1.2</jstl.version>
		<taglibs-standard.version>1.1.2</taglibs-standard.version>

		<maven.compiler.plugin>2.3.2</maven.compiler.plugin>
		<maven.failsafe.plugin>2.4.3-alpha-1</maven.failsafe.plugin>

	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>prime-repo</id>
			<name>PrimeFaces Maven Repository</name>
			<url>http://repository.primefaces.org</url>
			<layout>default</layout>
		</repository>
	</repositories>

	<dependencies>
		<!-- Servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>${servlet.version}</version>
			<scope>provided</scope>
		</dependency>
		<!-- Faces Implementation -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.4</version>
		</dependency>
		<!-- Faces Library -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.4</version>
		</dependency>
		<!-- Primefaces Version 5 -->
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0.RC2</version>
		</dependency>
		<!-- JSP Library -->
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>javax.servlet.jsp-api</artifactId>
			<version>2.3.1</version>
		</dependency>
		<!-- JSTL Library -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
		</dependency>
		<!-- SLF4J dependency -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.6.1</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>4.0.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.0.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.0.0.RELEASE</version>
		</dependency>
		<!-- Neo4j support for Spring Data -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-neo4j</artifactId>
			<version>2.3.5.RELEASE</version>
		</dependency>
		<!-- Advanced Mapping support for Spring Data Neo4j -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-neo4j-aspects</artifactId>
			<version>2.3.5.RELEASE</version>
		</dependency>
		<!-- Neo4j transaction library -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-neo4j-tx</artifactId>
			<version>2.3.5.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-neo4j-rest</artifactId>
			<version>2.3.5.RELEASE</version>
		</dependency>
		<!-- Google List Library -->
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>r09</version>
		</dependency>
		<!-- Dependency for REST Exporter -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-rest-webmvc</artifactId>
			<version>2.0.2.RELEASE</version>
		</dependency>
	</dependencies>

</project>

By deploying that application you will be getting an exception like the one below:

May 15, 2014 12:52:52 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.6.0_26\jre\bin;org.C:\Program Files (x86)\Common Files\NetSarang;D:\QTEL\Work\Oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;D:\Maven\apache-maven-3.2.1\bin;D:\Ant\apache-ant-1.9.2\bin;jrockit_160_14_R27.6.5-32\bin;D:/php/php-5.5.8;D:\SpringRoo\spring-roo-1.2.5.RELEASE\bin;%HADOOP_PREFIX%\bin;C:\Python27;.
May 15, 2014 12:52:53 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:JavaBeat-Primefaces-SpringData-Neo4j' did not find a matching property.
May 15, 2014 12:52:53 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 15, 2014 12:52:53 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 15, 2014 12:52:53 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 832 ms
May 15, 2014 12:52:53 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 15, 2014 12:52:53 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
May 15, 2014 12:52:59 AM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
May 15, 2014 12:52:59 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 15, 2014 12:52:59 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
May 15, 2014 12:52:59 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\Krishna\EclipseLink\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\JavaBeat-Primefaces-SpringData-Neo4j\WEB-INF\classes\net\javabeat\springdata\beans\RegistrationService.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:301)
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
	at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:85)
	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1414)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:187)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:63)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:82)
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:277)
	... 33 more
May 15, 2014 12:52:59 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.2.4 ( 20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574) for context '/JavaBeat-Primefaces-Web'
May 15, 2014 12:53:00 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
May 15, 2014 12:53:01 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 5.0.RC2
May 15, 2014 12:53:01 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
May 15, 2014 12:53:01 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/JavaBeat-Primefaces-Web] startup failed due to previous errors
May 15, 2014 12:53:01 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
May 15, 2014 12:53:01 AM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
	at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921)
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
	at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551)
	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5484)
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
May 15, 2014 12:53:01 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 15, 2014 12:53:01 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 15, 2014 12:53:01 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8241 ms

If you’ve just noticed that exception which tells you that a class ClassMetadataReadingVisitor causing incompatibleClassChangeError. The reason is that, it doesn’t implements an interface in the Spring asm library.

Problem Resolution

For investigating the problem we need to use the dependency tree tool, in that the command mvn dependency:tree has been invoked against the above pom file which would display the below result:


D:\Krishna\EclipseLink\Workspace\JavaBeat-Primefaces-SpringData-Neo4j>mvn dependency:tree
Bad level value for property: .level
Bad level value for property: java.util.logging.ConsoleHandler.level
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaBeat-Primefaces-SpringData-Neo4j 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ JavaBeat-Primefaces-SpringData-Neo4j ---
[INFO] next.javabeat.jsf:JavaBeat-Primefaces-SpringData-Neo4j:war:1.0
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- com.sun.faces:jsf-impl:jar:2.2.4:compile
[INFO] +- com.sun.faces:jsf-api:jar:2.2.4:compile
[INFO] +- org.primefaces:primefaces:jar:5.0.RC2:compile
[INFO] +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:compile
[INFO] +- javax.servlet:jstl:jar:1.1.2:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] |  \- log4j:log4j:jar:1.2.16:compile
[INFO] +- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework:spring-beans:jar:4.0.0.RELEASE:compile
[INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.springframework:spring-core:jar:4.0.0.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.0.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.0.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-neo4j:jar:2.3.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aspects:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context-support:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.7.2:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.6.5.RELEASE:compile
[INFO] |  +- org.neo4j:neo4j-cypher-dsl:jar:1.9:compile
[INFO] |  +- org.neo4j:neo4j:jar:1.9.3:compile
[INFO] |  |  +- org.neo4j:neo4j-lucene-index:jar:1.9.3:compile
[INFO] |  |  |  \- org.apache.lucene:lucene-core:jar:3.6.2:compile
[INFO] |  |  +- org.neo4j:neo4j-graph-algo:jar:1.9.3:compile
[INFO] |  |  +- org.neo4j:neo4j-udc:jar:1.9.3:compile
[INFO] |  |  +- org.neo4j:neo4j-graph-matching:jar:1.9.3:compile
[INFO] |  |  \- org.neo4j:neo4j-jmx:jar:1.9.3:compile
[INFO] |  +- org.neo4j:neo4j-cypher:jar:1.9.3:compile
[INFO] |  |  +- org.scala-lang:scala-library:jar:2.10.0:compile
[INFO] |  |  \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.3.1:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- org.springframework.data:spring-data-neo4j-aspects:jar:2.3.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.neo4j:neo4j-kernel:jar:1.9.3:compile
[INFO] |  |  \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  \- cglib:cglib:jar:2.2.2:compile
[INFO] |     \- asm:asm:jar:3.3.1:compile
[INFO] +- org.springframework.data:spring-data-neo4j-tx:jar:2.3.5.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-neo4j-rest:jar:2.3.5.RELEASE:compile
[INFO] |  +- org.neo4j:neo4j-rest-graphdb:jar:1.9:compile
[INFO] |  |  \- org.neo4j:server-api:jar:1.9:compile
[INFO] |  |     +- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile
[INFO] |  |     +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |     |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |     |  +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  |     |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  |     \- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] |  |        \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.7:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.7:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.7:compile
[INFO] |  \- com.sun.jersey:jersey-client:jar:1.4:compile
[INFO] |     \- com.sun.jersey:jersey-core:jar:1.4:compile
[INFO] +- com.google.guava:guava:jar:r09:compile
[INFO] \- org.springframework.data:spring-data-rest-webmvc:jar:2.0.2.RELEASE:compile
[INFO]    +- org.springframework.data:spring-data-rest-core:jar:2.0.2.RELEASE:compile
[INFO]    |  +- org.springframework.hateoas:spring-hateoas:jar:0.9.0.RELEASE:compile
[INFO]    |  |  \- org.objenesis:objenesis:jar:1.3:compile
[INFO]    |  +- org.springframework.plugin:spring-plugin-core:jar:1.0.0.RELEASE:compile
[INFO]    |  \- org.atteo:evo-inflector:jar:1.0.1:compile
[INFO]    \- com.fasterxml.jackson.core:jackson-databind:jar:2.3.1:compile
[INFO]       +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO]       \- com.fasterxml.jackson.core:jackson-core:jar:2.3.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.794 s
[INFO] Finished at: 2014-05-15T00:56:09+02:00
[INFO] Final Memory: 40M/64M
[INFO] ------------------------------------------------------------------------
D:\Krishna\EclipseLink\Workspace\JavaBeat-Primefaces-SpringData-Neo4j>

The Spring asm version that imported is org.springframework:spring-asm:jar:3.1.4.RELEASE:compile which consider older than required for spring core library. That is the main reason why this exception is thrown.

The library that caused that error is:

[INFO] +- org.springframework.data:spring-data-neo4j-aspects:jar:2.3.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile

So, let’s exclude the Spring asm from this dependency by using exclusions maven tag. By that the pom.xml file should look like

<dependency>
	<groupId>org.springframework.data</groupId>
	<artifactId>spring-data-neo4j-aspects</artifactId>
	<version>2.3.5.RELEASE</version>
	<exclusions>
		<exclusion>
			<groupId>org.springframework</groupId>
			<artifactId>spring-asm</artifactId>
		</exclusion>
	</exclusions>
</dependency>

By excluding the old spring-asm dependency the new asm 3.3.1  dependency should be imported automatically and your application should be running smoothly.

If you haven’t added any library in your application such as CGLIB that could contain the asm 3.3.1 you can add the following dependency for your pom.xml file.

		<!-- Separate ASM Library -->
<dependency>
 <groupId>asm</groupId>
 <artifactId>asm-all</artifactId>
 <version>3.3.1</version>
</dependency>

Comments

comments

About Amr Mohammed

Speak Your Mind

*