0

enter image description hereDespite having appropriate jars in classpath Spring Boot throws - java.lang.ClassNotFoundException: org.apache.camel.spring.spi.XmlCamelContextConfigurer

Any suggestions what is missing here.

I have added the respective starters in pom.xml as shown below:

    <dependency>
        <groupId>org.springframework.boot</groupId>[![enter image description here][1]][1]
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.19.3</version>
    </dependency>

The project maven dependencies also shows the class availability, as in given image attachment.

techsavvy
  • 143
  • 3
  • 16

1 Answers1

0

the answer is here - https://stackoverflow.com/a/34271507/2885422 It all depends how maven loads the class. There are 2 version of camel-spring.jars available in classpath (2.20.1 and 2.19.3. Ref: my original post image) And org.apache.camel.spring.spi.XmlCamelContextConfigurer class is available only in 2.20.1 jars. And maven by default looks in earlier one and once package found matching but no class found throws error (?)

And the reason I believe 2.19.3 get loaded is Apache-cxf jars is of 2.19.3. Unfortunately our project repository does not have apache-cxf starter jars.

https://stackoverflow.com/a/34271507/2885422

Solution: - I hope it may be helpful for future references By adding options I could resolve the issue,by having exclusion clause added as given below. Thus I could load only required version jars.

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.19.3</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-spring</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>'
techsavvy
  • 143
  • 3
  • 16