spring-bootapache-camelapache-camel-mail

How to resolve [http://camel.apache.org/schema/spring/camel-spring.xsd] not found?


I upgraded my Apache Camel+Springboot+Camel-Mail project from 3.20.6 to 4.7 (camel) and 2.5.0 to 3.3.3 (Springboot starter). And the project starts failing to run with below extract of logs.

Error: WARN 16272 --- [main] o.s.b.f.xml.XmlBeanDefinitionReader : Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://camel.apache.org/schema/spring/camel-spring.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema.

camel-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    //some more business logic code here

I have already included camel-spring as a dependency. It is already a compile time dependency in the camel-spring-boot-starter. The nearest questions on this doesn't help me either.

What am I missing?


Solution

  • Reading the answer you linked, and trying to replicate the dependencies, I noticed that the artifact camel-spring-xml is not included by default through camel-spring-boot-starter, and it's in that artifact that is stored the local copy of the xsd. Try to add this dependency to your pom:

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-xml</artifactId>
        <version>4.7.0</version>
    </dependency>