Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.14.0
    • Component/s: camel-spring
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Upgrade to spring4.
      There is a non-backwards compatible change in spring 4.x which will cause:

      java.lang.IncompatibleClassChangeError: Found interface org.springframework.test.context.TestContext, but class was expected
              at org.apache.camel.test.spring.CamelSpringTestContextLoaderTestExecutionListener.prepareTestInstance(CamelSpringTestContextLoaderTestExecutionListener.java:35)
              at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:326)
              at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212)
              at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
              at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
              at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
              at org.apache.camel.test.junit4.CamelSpringJUnit4ClassRunner.runChild(CamelSpringJUnit4ClassRunner.java:37)
              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
              at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
              at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
              at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
              at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
              at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
      

      due to https://jira.springsource.org/browse/SPR-7692

      There are no Sub-Tasks for this issue.

        Activity

        Hide
        Willem Jiang added a comment -

        It looks you need to recompile the camel-spring with Spring 4.x to fix this issue.
        It is a common issue

        I just ran the tests after upgrade the spring version to 4.x, I don't hit the issue as you meet.

        Show
        Willem Jiang added a comment - It looks you need to recompile the camel-spring with Spring 4.x to fix this issue. It is a common issue I just ran the tests after upgrade the spring version to 4.x, I don't hit the issue as you meet.
        Hide
        David J. M. Karlsen added a comment -

        Willem Jiang: exactly - and that's why I created the issue, wondering what version of camel this would be done for.

        Show
        David J. M. Karlsen added a comment - Willem Jiang : exactly - and that's why I created the issue, wondering what version of camel this would be done for.
        Hide
        Henrik added a comment -

        Is there any ETA on this issue?

        Show
        Henrik added a comment - Is there any ETA on this issue?
        Hide
        Willem Jiang added a comment - - edited

        It's not an easy job to do the upgrading if there are lots of other projects (products) are based on camel, as they are some gap between spring 3.x and spring 4.x, it could take some time.

        In the camel master branch we have spring4 profile can be used if you want to play with camel and spring 4.x yourself.

        Show
        Willem Jiang added a comment - - edited It's not an easy job to do the upgrading if there are lots of other projects (products) are based on camel, as they are some gap between spring 3.x and spring 4.x, it could take some time. In the camel master branch we have spring4 profile can be used if you want to play with camel and spring 4.x yourself.
        Hide
        David J. M. Karlsen added a comment -

        You can also monitor this job: https://builds.apache.org/job/Camel.trunk.fulltest.spring4/ . Guess cxf 3 is the last major step to get it to pass.

        Show
        David J. M. Karlsen added a comment - You can also monitor this job: https://builds.apache.org/job/Camel.trunk.fulltest.spring4/ . Guess cxf 3 is the last major step to get it to pass.
        Hide
        Henrik added a comment -

        Thanks!

        Show
        Henrik added a comment - Thanks!
        Hide
        Anna Ivashchuk added a comment -

        It would be great if it is fixed in the nearest future. For our project it is a stopper for migrating to spring 4

        Show
        Anna Ivashchuk added a comment - It would be great if it is fixed in the nearest future. For our project it is a stopper for migrating to spring 4
        Hide
        Morten Kjetland added a comment -

        Our reason for wanting Spring 4 support is to make Camel work with Java 8, as Spring 3.2.x is not compatible with it.

        This can also be fixed if Spring adds java 8 byte-code compatibility in 3.2.9 as described in this issue:
        https://jira.spring.io/browse/SPR-11656 (With pull-request)

        Show
        Morten Kjetland added a comment - Our reason for wanting Spring 4 support is to make Camel work with Java 8, as Spring 3.2.x is not compatible with it. This can also be fixed if Spring adds java 8 byte-code compatibility in 3.2.9 as described in this issue: https://jira.spring.io/browse/SPR-11656 (With pull-request)
        Hide
        Henrik added a comment -

        Morten: That pull request has been merged into the 3.2.x branch and will be present in 3.2.9: https://github.com/spring-projects/spring-framework/commit/9ac46a965f3314f09ec5a75eded97589ab13fbdb

        Show
        Henrik added a comment - Morten: That pull request has been merged into the 3.2.x branch and will be present in 3.2.9: https://github.com/spring-projects/spring-framework/commit/9ac46a965f3314f09ec5a75eded97589ab13fbdb
        Show
        David J. M. Karlsen added a comment - cxf 3.0 shouldn't be far away now: http://cxf.547215.n5.nabble.com/When-Will-3-0-Officially-Release-td5743388.html
        Hide
        Willem Jiang added a comment -

        We could move the camel trunk to use CXF 3.0-SNAPSHOT to verify the upgrade before CXF is released.

        Show
        Willem Jiang added a comment - We could move the camel trunk to use CXF 3.0-SNAPSHOT to verify the upgrade before CXF is released.
        Hide
        Matt Raible added a comment -

        Any movement on this? It looks like CXF 3.0 was released over a month ago.

        http://cxf.547215.n5.nabble.com/ANNOUNCE-Apache-CXF-3-0-0-released-td5744242.html

        Show
        Matt Raible added a comment - Any movement on this? It looks like CXF 3.0 was released over a month ago. http://cxf.547215.n5.nabble.com/ANNOUNCE-Apache-CXF-3-0-0-released-td5744242.html
        Hide
        Willem Jiang added a comment -

        Hi Matt,

        I already upgraded the CXF version to 3.0 in camel master, now there are two other sub task: ibats spring4 support and spring DM verification.

        Show
        Willem Jiang added a comment - Hi Matt, I already upgraded the CXF version to 3.0 in camel master, now there are two other sub task: ibats spring4 support and spring DM verification.
        Hide
        Matt Raible added a comment -

        Thanks for the update Willem. In my particular project, I'm not using iBATIS or Spring DM. Are there snapshot versions available for the following dependencies?

        $ mvn dependency:tree | grep camel
        [INFO] +- org.apache.camel:camel-csv:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-core:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-spring:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-spring-javaconfig:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-cxf:jar:2.13.1:compile
        [INFO] | +- org.apache.camel:camel-cxf-transport:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-freemarker:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-mail:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-sql:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-stream:jar:2.13.1:compile
        [INFO] +- org.apache.camel:camel-test:jar:2.13.1:test
        [INFO] +- org.apache.camel:camel-test-spring:jar:2.13.1:compile

        Show
        Matt Raible added a comment - Thanks for the update Willem. In my particular project, I'm not using iBATIS or Spring DM. Are there snapshot versions available for the following dependencies? $ mvn dependency:tree | grep camel [INFO] +- org.apache.camel:camel-csv:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-core:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-spring:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-spring-javaconfig:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-cxf:jar:2.13.1:compile [INFO] | +- org.apache.camel:camel-cxf-transport:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-freemarker:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-mail:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-sql:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-stream:jar:2.13.1:compile [INFO] +- org.apache.camel:camel-test:jar:2.13.1:test [INFO] +- org.apache.camel:camel-test-spring:jar:2.13.1:compile
        Hide
        Willem Jiang added a comment -

        Can you try to use camel 2.14-SNAPSHOT? Camel 2.14.0 is targeted to support Spring 4.x.

        Show
        Willem Jiang added a comment - Can you try to use camel 2.14-SNAPSHOT? Camel 2.14.0 is targeted to support Spring 4.x.
        Hide
        Claus Ibsen added a comment -

        We used to have links to the snapshot repo from: http://camel.apache.org/download
        But an infra guy complained.

        So you gotta find the apache snapshot repo yourself.

        A good place to look is the pom.xml of Camel
        https://github.com/apache/camel/blob/master/pom.xml#L93

        And you can also build from source yourself
        http://camel.apache.org/building.html

        And btw Camel 2.13.x is likely supporting spring 4.x already. Just try use it with spring 4.
        Its only really OSGi that is the big problem as spring-dm does not work with spring 4.

        Show
        Claus Ibsen added a comment - We used to have links to the snapshot repo from: http://camel.apache.org/download But an infra guy complained. So you gotta find the apache snapshot repo yourself. A good place to look is the pom.xml of Camel https://github.com/apache/camel/blob/master/pom.xml#L93 And you can also build from source yourself http://camel.apache.org/building.html And btw Camel 2.13.x is likely supporting spring 4.x already. Just try use it with spring 4. Its only really OSGi that is the big problem as spring-dm does not work with spring 4.
        Hide
        Matt Raible added a comment -

        If I try to upgrade to Spring 4.0.5 (while using Camel 2.13.1 and CXF 2.7.11), I get the following error:

        java.lang.IncompatibleClassChangeError: Found interface org.springframework.test.context.TestContext, but class was expected
        	at org.apache.camel.test.spring.CamelSpringTestContextLoaderTestExecutionListener.prepareTestInstance(CamelSpringTestContextLoaderTestExecutionListener.java:34)
        	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:331)
        	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:213)
        	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:290)
        

        I can fix this by changing to camel 2.14-snapshot, then checking out camel-test-spring and changing all "spring.version" placeholders to "spring4-version". Then installing it so it's used instead of the one in https://repository.apache.org/content/repositories/snapshots/. After that, I'm able to upgrade to CXF 3.0.0 if I change some package names.

        So it seems like camel-test-spring is not Spring 4 compatible, yet.

        Show
        Matt Raible added a comment - If I try to upgrade to Spring 4.0.5 (while using Camel 2.13.1 and CXF 2.7.11), I get the following error: java.lang.IncompatibleClassChangeError: Found interface org.springframework.test.context.TestContext, but class was expected at org.apache.camel.test.spring.CamelSpringTestContextLoaderTestExecutionListener.prepareTestInstance(CamelSpringTestContextLoaderTestExecutionListener.java:34) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:331) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:213) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:290) I can fix this by changing to camel 2.14-snapshot, then checking out camel-test-spring and changing all "spring.version" placeholders to "spring4-version". Then installing it so it's used instead of the one in https://repository.apache.org/content/repositories/snapshots/ . After that, I'm able to upgrade to CXF 3.0.0 if I change some package names. So it seems like camel-test-spring is not Spring 4 compatible, yet.
        Hide
        Willem Jiang added a comment -

        Hi Matt,
        The issue is caused there are some API uncompatible changes between Spring 3.3.x and Spring 4.0.x. As we can only choice one spring version (Spring 3.3.x) to build the snapshot, if you are using Spring 4.0.x, you hit the compatible issue.
        I'm not sure if we can set the default build to use Spring 4.0.x in Camel 2.14.0, as lots of people still use Spring 3.3.x.

        Show
        Willem Jiang added a comment - Hi Matt, The issue is caused there are some API uncompatible changes between Spring 3.3.x and Spring 4.0.x. As we can only choice one spring version (Spring 3.3.x) to build the snapshot, if you are using Spring 4.0.x, you hit the compatible issue. I'm not sure if we can set the default build to use Spring 4.0.x in Camel 2.14.0, as lots of people still use Spring 3.3.x.
        Hide
        Matt Raible added a comment -

        I agree it's probably best not to require Spring 4 in a point release. For Camel 3.0, it might be doable. In the meantime, I don't think it's a good idea to prevent folks from using Spring 4. I think the easiest way forward is to create two modules: camel-test-spring and camel-test-spring3. The former compiles against Spring 4 and the latter against Spring 3. You could switch it so camel-test-spring defaults to Spring 3, but camel-test-spring4 doesn't seem to be forward-looking, as you hopefully won't need a camel-test-spring5.

        I've made this change in a fork and it works in my project. I can upgrade to Camel 2.14-SNAPSHOT and CXF 3.0 with Spring 3.2.8 (by using camel-test-spring3). I can also upgrade to Spring 4 if I use the upgraded camel-test-spring.

        Here's a pull request that has this change: https://github.com/apache/camel/pull/199

        Show
        Matt Raible added a comment - I agree it's probably best not to require Spring 4 in a point release. For Camel 3.0, it might be doable. In the meantime, I don't think it's a good idea to prevent folks from using Spring 4. I think the easiest way forward is to create two modules: camel-test-spring and camel-test-spring3. The former compiles against Spring 4 and the latter against Spring 3. You could switch it so camel-test-spring defaults to Spring 3, but camel-test-spring4 doesn't seem to be forward-looking, as you hopefully won't need a camel-test-spring5. I've made this change in a fork and it works in my project. I can upgrade to Camel 2.14-SNAPSHOT and CXF 3.0 with Spring 3.2.8 (by using camel-test-spring3). I can also upgrade to Spring 4 if I use the upgraded camel-test-spring. Here's a pull request that has this change: https://github.com/apache/camel/pull/199
        Hide
        Claus Ibsen added a comment -

        Thanks Matt

        Yeah we have done something similar in the past. So maybe its a good idea to have camel-test-spring3 for Spring 3.x users. And camel-test-spring is for Spring 4.x.

        Show
        Claus Ibsen added a comment - Thanks Matt Yeah we have done something similar in the past. So maybe its a good idea to have camel-test-spring3 for Spring 3.x users. And camel-test-spring is for Spring 4.x.
        Hide
        Willem Jiang added a comment -

        I just added camel-test-spring3 which is built with spring 3.2.x, now camel-test-spring is built with spring 4.x.

        Show
        Willem Jiang added a comment - I just added camel-test-spring3 which is built with spring 3.2.x, now camel-test-spring is built with spring 4.x.
        Hide
        Claus Ibsen added a comment -

        Spring 4.x is now supported.

        Camel 2.15 will switch to use spring 4.x as default out of the box.
        Camel 2.14 uses Spring 3.2.x as default, but supports Spring 4.x.

        Show
        Claus Ibsen added a comment - Spring 4.x is now supported. Camel 2.15 will switch to use spring 4.x as default out of the box. Camel 2.14 uses Spring 3.2.x as default, but supports Spring 4.x.

          People

          • Assignee:
            Willem Jiang
            Reporter:
            David J. M. Karlsen
          • Votes:
            17 Vote for this issue
            Watchers:
            21 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development