Announcement Announcement Module
Collapse
No announcement yet.
Dependency problem with Spring 3.2 with Spring Data JPA 1.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dependency problem with Spring 3.2 with Spring Data JPA 1.2

    On my project on which I was successfully using Spring Data JPA 1.2.0.RELEASE with Spring 3.1, I just changed my Maven dependency for spring-core to 3.2.0.RELEASE. I am getting a java.lang.IncompatibleClassChangeError when attempting to start my web container. Here's a sample of the stacktrace:

    Code:
    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) ~[na:1.6.0_29]
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) ~[na:1.6.0_29]
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[na:1.6.0_29]
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[na:1.6.0_29]
    	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1814) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.jboss.web.tomcat.service.WebAppClassLoader.findClass(WebAppClassLoader.java:75) ~[tmp6658054736622098672jbossweb-service.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.6.0_29]
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) ~[na:1.6.0_29]
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[na:1.6.0_29]
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[na:1.6.0_29]
    	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1814) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.jboss.web.tomcat.service.WebAppClassLoader.findClass(WebAppClassLoader.java:75) ~[tmp6658054736622098672jbossweb-service.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) ~[tmp8994960648441534081jbossweb.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)]
    	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:58) ~[spring-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) ~[spring-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101) ~[spring-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:237) ~[spring-context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    	... 150 common frames omitted
    My suspicion is that the culprit is Spring Data JPA 1.2.0's dependency on spring-asm, based on my reading of section C.3 of the appendices with the release notes.

    Am I correct in my suspicion? Is there any way (beyond waiting for an update to spring-data-jpa) around this?

    Thanks in advance!

  • #2
    Same here.
    Hope the Spring Data JPA will be upgraded quickly as I would love to use the new Test features in Spring 3.2.
    Any time frame for an update ?

    Comment


    • #3
      Just hit this too. You might be able to work around it with an exclusion:

      Code:
      <dependency>
      	<groupId>org.springframework.data</groupId>
      	<artifactId>spring-data-jpa</artifactId>
      	<version>${spring-data-jpa.version}</version>
      	<exclusions>
      		<exclusion>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-aop</artifactId>
      		</exclusion>
      	</exclusions>
      </dependency>
      Last edited by andrewcelerity; Dec 18th, 2012, 01:13 PM.

      Comment


      • #4
        That didn't work for me. Are there any other ideas how to workaround this issue?

        Comment


        • #5
          Similar problems. Something has changed for the better?

          P.S. Spring Data developers are reading this forum? You have a mess on the site! The latest version 1.1.0, when there is 1.2 and we are all waiting for 1.3. Also, links are not working, try to open the link to CI Build. Pay attention.

          Comment


          • #6
            Spring Data JPA works fine with Spring 3.2. We have several sample applications running this combination. See [0] for example. Please make sure you correctly set up your dependencies overriding *all* of the Spring Data JPA dependencies and locally define the versions of the Spring Framework library version to 3.2.0.RELEASE.

            Use mvn dependency:list to make sure you have succeeded in unifying all versions to 3.2.0.RELEASE. In some cases it might be enough to define the Spring Data JPA dependency *after* the Spring libraries as Maven will then favor the dependency version of the transitive dependencies of the Spring libraries instead of Spring Data JPA (i.e. will pull transitive libraries in 3.2, instead of 3.1.3).

            @ilyaskorik - what's the reason for this agressive tone? What's so hard about doing a Maven Central search [1] for the latest version? What's so hard about knowing how Maven dependency management works? You know, I hate writing replies like these but you're not serving anyone with this harsh tone. We're definitely open for feedback of any kind but there's no reason to offend people like this.

            [0] https://github.com/olivergierke/spring-restbucks
            [1] http://search.maven.org/#search%7Cga...pring-data-jpa
            Last edited by Oliver Gierke; Dec 20th, 2012, 03:53 PM.

            Comment


            • #7
              Originally posted by Oliver Gierke View Post
              @ilyaskorik - what's the reason for this agressive tone? What's so hard about doing a Maven Central search [1] for the latest version? What's so hard about knowing how Maven dependency management works? You know, I hate writing replies like these but you're not serving anyone with this harsh tone. We're definitely open for feedback of any kind but there's no reason to offend people like this.
              I assure you, no aggression. This is a machine translation spoils the emotional component.

              Most of all, I was astonishment. Website of the project looks abandoned. Your team has not updated it since May. In similar situation is project page on GitHub. And similar situation to the forum. Look at the first screen, there will be enough unanswered posts.

              If you are open to feedback, accept my astonishment, verging on easy criticism.

              Comment


              • #8
                After several experiments with a fresh mind, the following entry in maven pom has helped me:

                <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${version.spring}</version>
                </dependency>

                Comment


                • #9
                  Originally posted by ilyaskorik View Post
                  After several experiments with a fresh mind, the following entry in maven pom has helped me:
                  It didn't help me by itself. However, I had a look at my dependency hierarchy and figure out I was getting Spring-asm 3.1.1 from Spring-faces 2.3.1 which have a dependency to Spring-mvc 3.1.1...
                  So adding
                  Code:
                  		<dependency>
                  			<groupId>org.springframework</groupId>
                  			<artifactId>spring-webmvc</artifactId>
                  			<version>${spring.version}</version>
                  		</dependency>
                  resolved it for me.
                  Bottom line, you want to get rid of spring-asm.

                  Comment


                  • #10
                    Cannot find 3.2.0.RELEASE for spring-asm

                    Originally posted by Oliver Gierke View Post
                    Spring Data JPA works fine with Spring 3.2. We have several sample applications running this combination. See [0] for example. Please make sure you correctly set up your dependencies overriding *all* of the Spring Data JPA dependencies and locally define the versions of the Spring Framework library version to 3.2.0.RELEASE.

                    [0] https://github.com/olivergierke/spring-restbucks
                    [1] http://search.maven.org/#search%7Cga...pring-data-jpa

                    This works for most things. But for some reason spring-asm 3.2.0.RELEASE is not on maven central or on spring's own hosted artifactory. http://repo.springsource.org/webapp/...4&q=spring-asm. Anyone have any ideas? Why isn't it published?

                    Comment


                    • #11
                      Originally posted by rwalls3 View Post
                      This works for most things. But for some reason spring-asm 3.2.0.RELEASE is not on maven central or on spring's own hosted artifactory. http://repo.springsource.org/webapp/...4&q=spring-asm. Anyone have any ideas? Why isn't it published?
                      From the release notes :
                      C.3 Inlining of spring-asm jar
                      In versions 3.0 and 3.1, we published a discrete spring-asm containing repackaged org.objectweb.asm 3.x sources. As of Spring Framework 3.2, we have upgraded to org.objectweb.asm 4.0 and done away with the separate module jar, favoring inlining these classes directly within spring-core. This should cause no migration issue for most users; but on the off chance that you have spring-asm declared directly within your project's build script, you'll want to remove it when upgrading to Spring Framework 3.2.

                      Comment


                      • #12
                        Originally posted by rwalls3 View Post
                        This works for most things. But for some reason spring-asm 3.2.0.RELEASE is not on maven central or on spring's own hosted artifactory. http://repo.springsource.org/webapp/...4&q=spring-asm. Anyone have any ideas? Why isn't it published?
                        I think spring-asm is no longer required, since at least some of the classes have been moved to spring-core.jar
                        (try "Open Type" in Eclipse and search for "ClassVisitor")
                        So If you have some maven dependency that transitively includes "spring-asm" you must exclude it in your pom.
                        This worked for me ;-)

                        Comment


                        • #13
                          Removing spring-asm 3.1.3 dependency it works for me.

                          Comment


                          • #14
                            Work's for me too..... But I also have to remove the internal reference made by spring-ws-core MAVEN artifact to ASM....
                            should not the ASM be removed from it by developer's team ?

                            I'm using spring-ws-core 2.1.2.RELEASE

                            Comment


                            • #15
                              same here

                              Originally posted by maheshrpm View Post
                              Removing spring-asm 3.1.3 dependency it works for me.
                              This worked for me too. I was integrating jersey + spring. So I just included spring asm in my exclusion

                              Code:
                              <dependency>
                                          <groupId>com.sun.jersey.contribs</groupId>
                                          <artifactId>jersey-spring</artifactId>
                                          <version>${jersey.version}</version>
                                          <exclusions>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring-core</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring-web</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring-beans</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring-context</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                  <groupId>org.springframework</groupId>
                                                  <artifactId>spring-asm</artifactId>
                                              </exclusion>
                                          </exclusions>
                                      </dependency>
                              Last edited by devnull; Apr 11th, 2013, 10:21 PM.

                              Comment

                              Working...
                              X