Spring Boot Apache Camel (Red Hat Fuse) application throws exception for xml defined routes:...












0














I have a Spring Boot Apache Camel Application where I define some routes in XML, this is a simplified code:



Gradle Config:



buildscript {
ext {
springBootVersion = '1.5.14.RELEASE'
}
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
}

apply plugin: 'org.springframework.boot'

description = """myfuse"""

ext {
junitVersion = '5.2.0'
junitPlatformVersion = '1.2.0'
fabric8Version = '3.0.11.fuse-000065-redhat-3'
}

dependencyManagement {
imports {
mavenBom "io.fabric8:fabric8-project-bom-camel-spring-boot:${fabric8Version}"
}
}

dependencies {
compile 'org.apache.camel:camel-spring-boot-starter',
"org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-actuator"
testCompile 'es.mma.architecture:mma-arch-test',
"org.springframework.boot:spring-boot-starter-test",
'com.github.sbrannen:spring-test-junit5:1.0.2',
"org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}",
"org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
}


camel/camel-context.xml:



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route id="_route1">
<from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
<setBody>
<simple>foo XML message</simple>
</setBody>
<log message="${body}"/>
<to uri="log:fooXmlLog"/>
</route>
</camel:camelContext>
</beans>


According to the documentation I place the camel-context.xml in a classpath folder named camel.



When the application starts it throws the following exception (not recognizing the beans element although it is defined in the xml namespace):



Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.springframework.org/schema/beans", local:"beans"). Expected elements are <{http://camel.apache.org/schema/spring}aggregate>,<{http://camel.apache.org/schema/spring}aop>,<{http://camel.apache.org/schema/spring}asn1>,<{http://camel.apache.org/schema/spring}avro>,<{http://camel.apache.org/schema/spring}barcode>,<{http://camel.apache.org/schema/spring}base64>,<{http://camel.apache.org/schema/spring}batch-config>,<{http://camel.apache.org/schema/spring}bean>,<{http://camel.apache.org/schema/spring}beanPostProcessor>,<{http://camel.apache.org/schema/spring}beanio>,<{http://camel.apache.org/schema/spring}bindy>,<{http://camel.apache.org/schema/spring}blacklistServiceFilter>,<{http://camel.apache.org/schema/spring}boon>,<{http://camel.apache.org/schema/spring}cachingServiceDiscovery>,<{http://camel.apache.org/schema/spring}camelContext>,<{http://camel.apache.org/schema/spring}castor>,<{http://camel.apache.org/schema/spring}choice>,<{http://camel.apache.org/schema/spring}circuitBreaker>,<{http://camel.apache.org/schema/spring}claimCheck>,<{http://camel.apache.org/schema/spring}constant>,<{http://camel.apache.org/schema/spring}consulServiceDiscovery>,<{http://camel.apache.org/schema/spring}consumerTemplate>,<{http://camel.apache.org/schema/spring}contextScan>,<{http://camel.apache.org/schema/spring}convertBodyTo>,<{http://camel.apache.org/schema/spring}crypto>,<{http://camel.apache.org/schema/spring}csv>,<{http://camel.apache.org/schema/spring}customDataFormat>,<{http://camel.apache.org/schema/spring}customLoadBalancer>,<{http://camel.apache.org/schema/spring}customServiceFilter>,<{http://camel.apache.org/schema/spring}dataFormats>,<{http://camel.apache.org/schema/spring}defaultLoadBalancer>,<{http://camel.apache.org/schema/spring}delay>,<{http://camel.apache.org/schema/spring}delete>,<{http://camel.apache.org/schema/spring}description>,<{http://camel.apache.org/schema/spring}dnsServiceDiscovery>,<{http://camel.apache.org/schema/spring}doCatch>,<{http://camel.apache.org/schema/spring}doFinally>,<{http://camel.apache.org/schema/spring}doTry>,<{http://camel.apache.org/schema/spring}dynamicRouter>,<{http://camel.apache.org/schema/spring}el>,<{http://camel.apache.org/schema/spring}endpoint>,<{http://camel.apache.org/schema/spring}enrich>,<{http://camel.apache.org/schema/spring}errorHandler>,<{http://camel.apache.org/schema/spring}etcdServiceDiscovery>,<{http://camel.apache.org/schema/spring}exchangeProperty>,<{http://camel.apache.org/schema/spring}export>,<{http://camel.apache.org/schema/spring}expression>,<{http://camel.apache.org/schema/spring}expressionDefinition>,<{http://camel.apache.org/schema/spring}failover>,<{http://camel.apache.org/schema/spring}fhirJson>,<{http://camel.apache.org/schema/spring}fhirXml>,<{http://camel.apache.org/schema/spring}filter>,<{http://camel.apache.org/schema/spring}flatpack>,<{http://camel.apache.org/schema/spring}fluentTemplate>,<{http://camel.apache.org/schema/spring}from>,<{http://camel.apache.org/schema/spring}get>,<{http://camel.apache.org/schema/spring}globalOption>,<{http://camel.apache.org/schema/spring}globalOptions>,<{http://camel.apache.org/schema/spring}groovy>,<{http://camel.apache.org/schema/spring}gzip>,<{http://camel.apache.org/schema/spring}head>,<{http://camel.apache.org/schema/spring}header>,<{http://camel.apache.org/schema/spring}healthyServiceFilter>,<{http://camel.apache.org/schema/spring}hessian>,<{http://camel.apache.org/schema/spring}hl7>,<{http://camel.apache.org/schema/spring}hystrix>,<{http://camel.apache.org/schema/spring}hystrixConfiguration>,<{http://camel.apache.org/schema/spring}ical>,<{http://camel.apache.org/schema/spring}idempotentConsumer>,<{http://camel.apache.org/schema/spring}inOnly>,<{http://camel.apache.org/schema/spring}inOut>,<{http://camel.apache.org/schema/spring}inputType>,<{http://camel.apache.org/schema/spring}intercept>,<{http://camel.apache.org/schema/spring}interceptFrom>,<{http://camel.apache.org/schema/spring}interceptSendToEndpoint>,<{http://camel.apache.org/schema/spring}jacksonxml>,<{http://camel.apache.org/schema/spring}javaScript>,<{http://camel.apache.org/schema/spring}jaxb>,<{http://camel.apache.org/schema/spring}jibx>,<{http://camel.apache.org/schema/spring}jmxAgent>,<{http://camel.apache.org/schema/spring}json>,<{http://camel.apache.org/schema/spring}jsonpath>,<{http://camel.apache.org/schema/spring}jxpath>,<{http://camel.apache.org/schema/spring}keyStoreParameters>,<{http://camel.apache.org/schema/spring}kubernetesServiceDiscovery>,<{http://camel.apache.org/schema/spring}language>,<{http://camel.apache.org/schema/spring}loadBalance>,<{http://camel.apache.org/schema/spring}loadBalancerConfiguration>,<{http://camel.apache.org/schema/spring}log>,<{http://camel.apache.org/schema/spring}loop>,<{http://camel.apache.org/schema/spring}lzf>,<{http://camel.apache.org/schema/spring}marshal>,<{http://camel.apache.org/schema/spring}method>,<{http://camel.apache.org/schema/spring}mime-multipart>,<{http://camel.apache.org/schema/spring}multiServiceDiscovery>,<{http://camel.apache.org/schema/spring}multiServiceFilter>,<{http://camel.apache.org/schema/spring}multicast>,<{http://camel.apache.org/schema/spring}mvel>,<{http://camel.apache.org/schema/spring}ognl>,<{http://camel.apache.org/schema/spring}onCompletion>,<{http://camel.apache.org/schema/spring}onException>,<{http://camel.apache.org/schema/spring}onFallback>,<{http://camel.apache.org/schema/spring}optimisticLockRetryPolicy>,<{http://camel.apache.org/schema/spring}options>,<{http://camel.apache.org/schema/spring}otherwise>,<{http://camel.apache.org/schema/spring}outputType>,<{http://camel.apache.org/schema/spring}packageScan>,<{http://camel.apache.org/schema/spring}param>,<{http://camel.apache.org/schema/spring}passThroughServiceFilter>,<{http://camel.apache.org/schema/spring}patch>,<{http://camel.apache.org/schema/spring}pgp>,<{http://camel.apache.org/schema/spring}php>,<{http://camel.apache.org/schema/spring}pipeline>,<{http://camel.apache.org/schema/spring}policy>,<{http://camel.apache.org/schema/spring}pollEnrich>,<{http://camel.apache.org/schema/spring}post>,<{http://camel.apache.org/schema/spring}process>,<{http://camel.apache.org/schema/spring}properties>,<{http://camel.apache.org/schema/spring}propertiesFunction>,<{http://camel.apache.org/schema/spring}propertiesLocation>,<{http://camel.apache.org/schema/spring}property>,<{http://camel.apache.org/schema/spring}propertyPlaceholder>,<{http://camel.apache.org/schema/spring}protobuf>,<{http://camel.apache.org/schema/spring}proxy>,<{http://camel.apache.org/schema/spring}put>,<{http://camel.apache.org/schema/spring}python>,<{http://camel.apache.org/schema/spring}random>,<{http://camel.apache.org/schema/spring}recipientList>,<{http://camel.apache.org/schema/spring}redeliveryPolicy>,<{http://camel.apache.org/schema/spring}redeliveryPolicyProfile>,<{http://camel.apache.org/schema/spring}ref>,<{http://camel.apache.org/schema/spring}removeHeader>,<{http://camel.apache.org/schema/spring}removeHeaders>,<{http://camel.apache.org/schema/spring}removeProperties>,<{http://camel.apache.org/schema/spring}removeProperty>,<{http://camel.apache.org/schema/spring}resequence>,<{http://camel.apache.org/schema/spring}responseHeader>,<{http://camel.apache.org/schema/spring}responseMessage>,<{http://camel.apache.org/schema/spring}rest>,<{http://camel.apache.org/schema/spring}restBinding>,<{http://camel.apache.org/schema/spring}restConfiguration>,<{http://camel.apache.org/schema/spring}restContext>,<{http://camel.apache.org/schema/spring}restContextRef>,<{http://camel.apache.org/schema/spring}restProperty>,<{http://camel.apache.org/schema/spring}rests>,<{http://camel.apache.org/schema/spring}ribbonLoadBalancer>,<{http://camel.apache.org/schema/spring}rollback>,<{http://camel.apache.org/schema/spring}roundRobin>,<{http://camel.apache.org/schema/spring}route>,<{http://camel.apache.org/schema/spring}routeBuilder>,<{http://camel.apache.org/schema/spring}routeContext>,<{http://camel.apache.org/schema/spring}routeContextRef>,<{http://camel.apache.org/schema/spring}routes>,<{http://camel.apache.org/schema/spring}routingSlip>,<{http://camel.apache.org/schema/spring}rss>,<{http://camel.apache.org/schema/spring}ruby>,<{http://camel.apache.org/schema/spring}saga>,<{http://camel.apache.org/schema/spring}sample>,<{http://camel.apache.org/schema/spring}script>,<{http://camel.apache.org/schema/spring}secureRandomParameters>,<{http://camel.apache.org/schema/spring}secureXML>,<{http://camel.apache.org/schema/spring}serialization>,<{http://camel.apache.org/schema/spring}serviceCall>,<{http://camel.apache.org/schema/spring}serviceCallConfiguration>,<{http://camel.apache.org/schema/spring}serviceChooserConfiguration>,<{http://camel.apache.org/schema/spring}serviceDiscoveryConfiguration>,<{http://camel.apache.org/schema/spring}serviceExpression>,<{http://camel.apache.org/schema/spring}serviceFilterConfiguration>,<{http://camel.apache.org/schema/spring}setBody>,<{http://camel.apache.org/schema/spring}setExchangePattern>,<{http://camel.apache.org/schema/spring}setFaultBody>,<{http://camel.apache.org/schema/spring}setHeader>,<{http://camel.apache.org/schema/spring}setOutHeader>,<{http://camel.apache.org/schema/spring}setProperty>,<{http://camel.apache.org/schema/spring}simple>,<{http://camel.apache.org/schema/spring}soapjaxb>,<{http://camel.apache.org/schema/spring}sort>,<{http://camel.apache.org/schema/spring}spel>,<{http://camel.apache.org/schema/spring}split>,<{http://camel.apache.org/schema/spring}sql>,<{http://camel.apache.org/schema/spring}sslContextParameters>,<{http://camel.apache.org/schema/spring}staticServiceDiscovery>,<{http://camel.apache.org/schema/spring}sticky>,<{http://camel.apache.org/schema/spring}stop>,<{http://camel.apache.org/schema/spring}stream-config>,<{http://camel.apache.org/schema/spring}streamCaching>,<{http://camel.apache.org/schema/spring}string>,<{http://camel.apache.org/schema/spring}syslog>,<{http://camel.apache.org/schema/spring}tarfile>,<{http://camel.apache.org/schema/spring}template>,<{http://camel.apache.org/schema/spring}terser>,<{http://camel.apache.org/schema/spring}threadPool>,<{http://camel.apache.org/schema/spring}threadPoolProfile>,<{http://camel.apache.org/schema/spring}threads>,<{http://camel.apache.org/schema/spring}thrift>,<{http://camel.apache.org/schema/spring}throttle>,<{http://camel.apache.org/schema/spring}throwException>,<{http://camel.apache.org/schema/spring}tidyMarkup>,<{http://camel.apache.org/schema/spring}to>,<{http://camel.apache.org/schema/spring}toD>,<{http://camel.apache.org/schema/spring}tokenize>,<{http://camel.apache.org/schema/spring}topic>,<{http://camel.apache.org/schema/spring}transacted>,<{http://camel.apache.org/schema/spring}transform>,<{http://camel.apache.org/schema/spring}transformers>,<{http://camel.apache.org/schema/spring}typeFilter>,<{http://camel.apache.org/schema/spring}univocity-csv>,<{http://camel.apache.org/schema/spring}univocity-fixed>,<{http://camel.apache.org/schema/spring}univocity-header>,<{http://camel.apache.org/schema/spring}univocity-tsv>,<{http://camel.apache.org/schema/spring}unmarshal>,<{http://camel.apache.org/schema/spring}validate>,<{http://camel.apache.org/schema/spring}validators>,<{http://camel.apache.org/schema/spring}verb>,<{http://camel.apache.org/schema/spring}weighted>,<{http://camel.apache.org/schema/spring}when>,<{http://camel.apache.org/schema/spring}wireTap>,<{http://camel.apache.org/schema/spring}xmlBeans>,<{http://camel.apache.org/schema/spring}xmljson>,<{http://camel.apache.org/schema/spring}xmlrpc>,<{http://camel.apache.org/schema/spring}xpath>,<{http://camel.apache.org/schema/spring}xquery>,<{http://camel.apache.org/schema/spring}xstream>,<{http://camel.apache.org/schema/spring}xtokenize>,<{http://camel.apache.org/schema/spring}yaml>,<{http://camel.apache.org/schema/spring}zip>,<{http://camel.apache.org/schema/spring}zipFile>,<{http://camel.apache.org/schema/spring}zookeeperServiceDiscovery>
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:743) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:257) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:124) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1148) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:573) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:555) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:75) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:110) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:103) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:161) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:132) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:171) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:152) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
at org.apache.camel.impl.DefaultCamelContext.loadRoutesDefinition(DefaultCamelContext.java:1034) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
at org.apache.camel.spring.boot.RoutesCollector.loadXmlRoutes(RoutesCollector.java:281) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:142) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
... 16 common frames omitted


Why isn't it allowing the use of the beans element?



Now something weird: I move the camel-context.xml file to another folder: spring/camel-context.xml, and import the XML directly in the Spring Boot Application context:



@SpringBootApplication
@ImportResource({"classpath:spring/camel-context.xml"})
public class CamelSpringBootApplication {


Now it works fine (???).










share|improve this question



























    0














    I have a Spring Boot Apache Camel Application where I define some routes in XML, this is a simplified code:



    Gradle Config:



    buildscript {
    ext {
    springBootVersion = '1.5.14.RELEASE'
    }
    repositories {
    maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
    }

    apply plugin: 'org.springframework.boot'

    description = """myfuse"""

    ext {
    junitVersion = '5.2.0'
    junitPlatformVersion = '1.2.0'
    fabric8Version = '3.0.11.fuse-000065-redhat-3'
    }

    dependencyManagement {
    imports {
    mavenBom "io.fabric8:fabric8-project-bom-camel-spring-boot:${fabric8Version}"
    }
    }

    dependencies {
    compile 'org.apache.camel:camel-spring-boot-starter',
    "org.springframework.boot:spring-boot-starter-web",
    "org.springframework.boot:spring-boot-starter-actuator"
    testCompile 'es.mma.architecture:mma-arch-test',
    "org.springframework.boot:spring-boot-starter-test",
    'com.github.sbrannen:spring-test-junit5:1.0.2',
    "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
    testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}",
    "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
    }


    camel/camel-context.xml:



    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    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">
    <camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route id="_route1">
    <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
    <setBody>
    <simple>foo XML message</simple>
    </setBody>
    <log message="${body}"/>
    <to uri="log:fooXmlLog"/>
    </route>
    </camel:camelContext>
    </beans>


    According to the documentation I place the camel-context.xml in a classpath folder named camel.



    When the application starts it throws the following exception (not recognizing the beans element although it is defined in the xml namespace):



    Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.springframework.org/schema/beans", local:"beans"). Expected elements are <{http://camel.apache.org/schema/spring}aggregate>,<{http://camel.apache.org/schema/spring}aop>,<{http://camel.apache.org/schema/spring}asn1>,<{http://camel.apache.org/schema/spring}avro>,<{http://camel.apache.org/schema/spring}barcode>,<{http://camel.apache.org/schema/spring}base64>,<{http://camel.apache.org/schema/spring}batch-config>,<{http://camel.apache.org/schema/spring}bean>,<{http://camel.apache.org/schema/spring}beanPostProcessor>,<{http://camel.apache.org/schema/spring}beanio>,<{http://camel.apache.org/schema/spring}bindy>,<{http://camel.apache.org/schema/spring}blacklistServiceFilter>,<{http://camel.apache.org/schema/spring}boon>,<{http://camel.apache.org/schema/spring}cachingServiceDiscovery>,<{http://camel.apache.org/schema/spring}camelContext>,<{http://camel.apache.org/schema/spring}castor>,<{http://camel.apache.org/schema/spring}choice>,<{http://camel.apache.org/schema/spring}circuitBreaker>,<{http://camel.apache.org/schema/spring}claimCheck>,<{http://camel.apache.org/schema/spring}constant>,<{http://camel.apache.org/schema/spring}consulServiceDiscovery>,<{http://camel.apache.org/schema/spring}consumerTemplate>,<{http://camel.apache.org/schema/spring}contextScan>,<{http://camel.apache.org/schema/spring}convertBodyTo>,<{http://camel.apache.org/schema/spring}crypto>,<{http://camel.apache.org/schema/spring}csv>,<{http://camel.apache.org/schema/spring}customDataFormat>,<{http://camel.apache.org/schema/spring}customLoadBalancer>,<{http://camel.apache.org/schema/spring}customServiceFilter>,<{http://camel.apache.org/schema/spring}dataFormats>,<{http://camel.apache.org/schema/spring}defaultLoadBalancer>,<{http://camel.apache.org/schema/spring}delay>,<{http://camel.apache.org/schema/spring}delete>,<{http://camel.apache.org/schema/spring}description>,<{http://camel.apache.org/schema/spring}dnsServiceDiscovery>,<{http://camel.apache.org/schema/spring}doCatch>,<{http://camel.apache.org/schema/spring}doFinally>,<{http://camel.apache.org/schema/spring}doTry>,<{http://camel.apache.org/schema/spring}dynamicRouter>,<{http://camel.apache.org/schema/spring}el>,<{http://camel.apache.org/schema/spring}endpoint>,<{http://camel.apache.org/schema/spring}enrich>,<{http://camel.apache.org/schema/spring}errorHandler>,<{http://camel.apache.org/schema/spring}etcdServiceDiscovery>,<{http://camel.apache.org/schema/spring}exchangeProperty>,<{http://camel.apache.org/schema/spring}export>,<{http://camel.apache.org/schema/spring}expression>,<{http://camel.apache.org/schema/spring}expressionDefinition>,<{http://camel.apache.org/schema/spring}failover>,<{http://camel.apache.org/schema/spring}fhirJson>,<{http://camel.apache.org/schema/spring}fhirXml>,<{http://camel.apache.org/schema/spring}filter>,<{http://camel.apache.org/schema/spring}flatpack>,<{http://camel.apache.org/schema/spring}fluentTemplate>,<{http://camel.apache.org/schema/spring}from>,<{http://camel.apache.org/schema/spring}get>,<{http://camel.apache.org/schema/spring}globalOption>,<{http://camel.apache.org/schema/spring}globalOptions>,<{http://camel.apache.org/schema/spring}groovy>,<{http://camel.apache.org/schema/spring}gzip>,<{http://camel.apache.org/schema/spring}head>,<{http://camel.apache.org/schema/spring}header>,<{http://camel.apache.org/schema/spring}healthyServiceFilter>,<{http://camel.apache.org/schema/spring}hessian>,<{http://camel.apache.org/schema/spring}hl7>,<{http://camel.apache.org/schema/spring}hystrix>,<{http://camel.apache.org/schema/spring}hystrixConfiguration>,<{http://camel.apache.org/schema/spring}ical>,<{http://camel.apache.org/schema/spring}idempotentConsumer>,<{http://camel.apache.org/schema/spring}inOnly>,<{http://camel.apache.org/schema/spring}inOut>,<{http://camel.apache.org/schema/spring}inputType>,<{http://camel.apache.org/schema/spring}intercept>,<{http://camel.apache.org/schema/spring}interceptFrom>,<{http://camel.apache.org/schema/spring}interceptSendToEndpoint>,<{http://camel.apache.org/schema/spring}jacksonxml>,<{http://camel.apache.org/schema/spring}javaScript>,<{http://camel.apache.org/schema/spring}jaxb>,<{http://camel.apache.org/schema/spring}jibx>,<{http://camel.apache.org/schema/spring}jmxAgent>,<{http://camel.apache.org/schema/spring}json>,<{http://camel.apache.org/schema/spring}jsonpath>,<{http://camel.apache.org/schema/spring}jxpath>,<{http://camel.apache.org/schema/spring}keyStoreParameters>,<{http://camel.apache.org/schema/spring}kubernetesServiceDiscovery>,<{http://camel.apache.org/schema/spring}language>,<{http://camel.apache.org/schema/spring}loadBalance>,<{http://camel.apache.org/schema/spring}loadBalancerConfiguration>,<{http://camel.apache.org/schema/spring}log>,<{http://camel.apache.org/schema/spring}loop>,<{http://camel.apache.org/schema/spring}lzf>,<{http://camel.apache.org/schema/spring}marshal>,<{http://camel.apache.org/schema/spring}method>,<{http://camel.apache.org/schema/spring}mime-multipart>,<{http://camel.apache.org/schema/spring}multiServiceDiscovery>,<{http://camel.apache.org/schema/spring}multiServiceFilter>,<{http://camel.apache.org/schema/spring}multicast>,<{http://camel.apache.org/schema/spring}mvel>,<{http://camel.apache.org/schema/spring}ognl>,<{http://camel.apache.org/schema/spring}onCompletion>,<{http://camel.apache.org/schema/spring}onException>,<{http://camel.apache.org/schema/spring}onFallback>,<{http://camel.apache.org/schema/spring}optimisticLockRetryPolicy>,<{http://camel.apache.org/schema/spring}options>,<{http://camel.apache.org/schema/spring}otherwise>,<{http://camel.apache.org/schema/spring}outputType>,<{http://camel.apache.org/schema/spring}packageScan>,<{http://camel.apache.org/schema/spring}param>,<{http://camel.apache.org/schema/spring}passThroughServiceFilter>,<{http://camel.apache.org/schema/spring}patch>,<{http://camel.apache.org/schema/spring}pgp>,<{http://camel.apache.org/schema/spring}php>,<{http://camel.apache.org/schema/spring}pipeline>,<{http://camel.apache.org/schema/spring}policy>,<{http://camel.apache.org/schema/spring}pollEnrich>,<{http://camel.apache.org/schema/spring}post>,<{http://camel.apache.org/schema/spring}process>,<{http://camel.apache.org/schema/spring}properties>,<{http://camel.apache.org/schema/spring}propertiesFunction>,<{http://camel.apache.org/schema/spring}propertiesLocation>,<{http://camel.apache.org/schema/spring}property>,<{http://camel.apache.org/schema/spring}propertyPlaceholder>,<{http://camel.apache.org/schema/spring}protobuf>,<{http://camel.apache.org/schema/spring}proxy>,<{http://camel.apache.org/schema/spring}put>,<{http://camel.apache.org/schema/spring}python>,<{http://camel.apache.org/schema/spring}random>,<{http://camel.apache.org/schema/spring}recipientList>,<{http://camel.apache.org/schema/spring}redeliveryPolicy>,<{http://camel.apache.org/schema/spring}redeliveryPolicyProfile>,<{http://camel.apache.org/schema/spring}ref>,<{http://camel.apache.org/schema/spring}removeHeader>,<{http://camel.apache.org/schema/spring}removeHeaders>,<{http://camel.apache.org/schema/spring}removeProperties>,<{http://camel.apache.org/schema/spring}removeProperty>,<{http://camel.apache.org/schema/spring}resequence>,<{http://camel.apache.org/schema/spring}responseHeader>,<{http://camel.apache.org/schema/spring}responseMessage>,<{http://camel.apache.org/schema/spring}rest>,<{http://camel.apache.org/schema/spring}restBinding>,<{http://camel.apache.org/schema/spring}restConfiguration>,<{http://camel.apache.org/schema/spring}restContext>,<{http://camel.apache.org/schema/spring}restContextRef>,<{http://camel.apache.org/schema/spring}restProperty>,<{http://camel.apache.org/schema/spring}rests>,<{http://camel.apache.org/schema/spring}ribbonLoadBalancer>,<{http://camel.apache.org/schema/spring}rollback>,<{http://camel.apache.org/schema/spring}roundRobin>,<{http://camel.apache.org/schema/spring}route>,<{http://camel.apache.org/schema/spring}routeBuilder>,<{http://camel.apache.org/schema/spring}routeContext>,<{http://camel.apache.org/schema/spring}routeContextRef>,<{http://camel.apache.org/schema/spring}routes>,<{http://camel.apache.org/schema/spring}routingSlip>,<{http://camel.apache.org/schema/spring}rss>,<{http://camel.apache.org/schema/spring}ruby>,<{http://camel.apache.org/schema/spring}saga>,<{http://camel.apache.org/schema/spring}sample>,<{http://camel.apache.org/schema/spring}script>,<{http://camel.apache.org/schema/spring}secureRandomParameters>,<{http://camel.apache.org/schema/spring}secureXML>,<{http://camel.apache.org/schema/spring}serialization>,<{http://camel.apache.org/schema/spring}serviceCall>,<{http://camel.apache.org/schema/spring}serviceCallConfiguration>,<{http://camel.apache.org/schema/spring}serviceChooserConfiguration>,<{http://camel.apache.org/schema/spring}serviceDiscoveryConfiguration>,<{http://camel.apache.org/schema/spring}serviceExpression>,<{http://camel.apache.org/schema/spring}serviceFilterConfiguration>,<{http://camel.apache.org/schema/spring}setBody>,<{http://camel.apache.org/schema/spring}setExchangePattern>,<{http://camel.apache.org/schema/spring}setFaultBody>,<{http://camel.apache.org/schema/spring}setHeader>,<{http://camel.apache.org/schema/spring}setOutHeader>,<{http://camel.apache.org/schema/spring}setProperty>,<{http://camel.apache.org/schema/spring}simple>,<{http://camel.apache.org/schema/spring}soapjaxb>,<{http://camel.apache.org/schema/spring}sort>,<{http://camel.apache.org/schema/spring}spel>,<{http://camel.apache.org/schema/spring}split>,<{http://camel.apache.org/schema/spring}sql>,<{http://camel.apache.org/schema/spring}sslContextParameters>,<{http://camel.apache.org/schema/spring}staticServiceDiscovery>,<{http://camel.apache.org/schema/spring}sticky>,<{http://camel.apache.org/schema/spring}stop>,<{http://camel.apache.org/schema/spring}stream-config>,<{http://camel.apache.org/schema/spring}streamCaching>,<{http://camel.apache.org/schema/spring}string>,<{http://camel.apache.org/schema/spring}syslog>,<{http://camel.apache.org/schema/spring}tarfile>,<{http://camel.apache.org/schema/spring}template>,<{http://camel.apache.org/schema/spring}terser>,<{http://camel.apache.org/schema/spring}threadPool>,<{http://camel.apache.org/schema/spring}threadPoolProfile>,<{http://camel.apache.org/schema/spring}threads>,<{http://camel.apache.org/schema/spring}thrift>,<{http://camel.apache.org/schema/spring}throttle>,<{http://camel.apache.org/schema/spring}throwException>,<{http://camel.apache.org/schema/spring}tidyMarkup>,<{http://camel.apache.org/schema/spring}to>,<{http://camel.apache.org/schema/spring}toD>,<{http://camel.apache.org/schema/spring}tokenize>,<{http://camel.apache.org/schema/spring}topic>,<{http://camel.apache.org/schema/spring}transacted>,<{http://camel.apache.org/schema/spring}transform>,<{http://camel.apache.org/schema/spring}transformers>,<{http://camel.apache.org/schema/spring}typeFilter>,<{http://camel.apache.org/schema/spring}univocity-csv>,<{http://camel.apache.org/schema/spring}univocity-fixed>,<{http://camel.apache.org/schema/spring}univocity-header>,<{http://camel.apache.org/schema/spring}univocity-tsv>,<{http://camel.apache.org/schema/spring}unmarshal>,<{http://camel.apache.org/schema/spring}validate>,<{http://camel.apache.org/schema/spring}validators>,<{http://camel.apache.org/schema/spring}verb>,<{http://camel.apache.org/schema/spring}weighted>,<{http://camel.apache.org/schema/spring}when>,<{http://camel.apache.org/schema/spring}wireTap>,<{http://camel.apache.org/schema/spring}xmlBeans>,<{http://camel.apache.org/schema/spring}xmljson>,<{http://camel.apache.org/schema/spring}xmlrpc>,<{http://camel.apache.org/schema/spring}xpath>,<{http://camel.apache.org/schema/spring}xquery>,<{http://camel.apache.org/schema/spring}xstream>,<{http://camel.apache.org/schema/spring}xtokenize>,<{http://camel.apache.org/schema/spring}yaml>,<{http://camel.apache.org/schema/spring}zip>,<{http://camel.apache.org/schema/spring}zipFile>,<{http://camel.apache.org/schema/spring}zookeeperServiceDiscovery>
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:743) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:257) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:124) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1148) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:573) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:555) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:75) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:110) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:103) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:161) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:132) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
    at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:171) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
    at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:152) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
    at org.apache.camel.impl.DefaultCamelContext.loadRoutesDefinition(DefaultCamelContext.java:1034) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
    at org.apache.camel.spring.boot.RoutesCollector.loadXmlRoutes(RoutesCollector.java:281) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
    at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:142) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
    ... 16 common frames omitted


    Why isn't it allowing the use of the beans element?



    Now something weird: I move the camel-context.xml file to another folder: spring/camel-context.xml, and import the XML directly in the Spring Boot Application context:



    @SpringBootApplication
    @ImportResource({"classpath:spring/camel-context.xml"})
    public class CamelSpringBootApplication {


    Now it works fine (???).










    share|improve this question

























      0












      0








      0







      I have a Spring Boot Apache Camel Application where I define some routes in XML, this is a simplified code:



      Gradle Config:



      buildscript {
      ext {
      springBootVersion = '1.5.14.RELEASE'
      }
      repositories {
      maven { url "https://plugins.gradle.org/m2/" }
      }
      dependencies {
      classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
      }
      }

      apply plugin: 'org.springframework.boot'

      description = """myfuse"""

      ext {
      junitVersion = '5.2.0'
      junitPlatformVersion = '1.2.0'
      fabric8Version = '3.0.11.fuse-000065-redhat-3'
      }

      dependencyManagement {
      imports {
      mavenBom "io.fabric8:fabric8-project-bom-camel-spring-boot:${fabric8Version}"
      }
      }

      dependencies {
      compile 'org.apache.camel:camel-spring-boot-starter',
      "org.springframework.boot:spring-boot-starter-web",
      "org.springframework.boot:spring-boot-starter-actuator"
      testCompile 'es.mma.architecture:mma-arch-test',
      "org.springframework.boot:spring-boot-starter-test",
      'com.github.sbrannen:spring-test-junit5:1.0.2',
      "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
      testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}",
      "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
      }


      camel/camel-context.xml:



      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:camel="http://camel.apache.org/schema/spring"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      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">
      <camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <route id="_route1">
      <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
      <setBody>
      <simple>foo XML message</simple>
      </setBody>
      <log message="${body}"/>
      <to uri="log:fooXmlLog"/>
      </route>
      </camel:camelContext>
      </beans>


      According to the documentation I place the camel-context.xml in a classpath folder named camel.



      When the application starts it throws the following exception (not recognizing the beans element although it is defined in the xml namespace):



      Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.springframework.org/schema/beans", local:"beans"). Expected elements are <{http://camel.apache.org/schema/spring}aggregate>,<{http://camel.apache.org/schema/spring}aop>,<{http://camel.apache.org/schema/spring}asn1>,<{http://camel.apache.org/schema/spring}avro>,<{http://camel.apache.org/schema/spring}barcode>,<{http://camel.apache.org/schema/spring}base64>,<{http://camel.apache.org/schema/spring}batch-config>,<{http://camel.apache.org/schema/spring}bean>,<{http://camel.apache.org/schema/spring}beanPostProcessor>,<{http://camel.apache.org/schema/spring}beanio>,<{http://camel.apache.org/schema/spring}bindy>,<{http://camel.apache.org/schema/spring}blacklistServiceFilter>,<{http://camel.apache.org/schema/spring}boon>,<{http://camel.apache.org/schema/spring}cachingServiceDiscovery>,<{http://camel.apache.org/schema/spring}camelContext>,<{http://camel.apache.org/schema/spring}castor>,<{http://camel.apache.org/schema/spring}choice>,<{http://camel.apache.org/schema/spring}circuitBreaker>,<{http://camel.apache.org/schema/spring}claimCheck>,<{http://camel.apache.org/schema/spring}constant>,<{http://camel.apache.org/schema/spring}consulServiceDiscovery>,<{http://camel.apache.org/schema/spring}consumerTemplate>,<{http://camel.apache.org/schema/spring}contextScan>,<{http://camel.apache.org/schema/spring}convertBodyTo>,<{http://camel.apache.org/schema/spring}crypto>,<{http://camel.apache.org/schema/spring}csv>,<{http://camel.apache.org/schema/spring}customDataFormat>,<{http://camel.apache.org/schema/spring}customLoadBalancer>,<{http://camel.apache.org/schema/spring}customServiceFilter>,<{http://camel.apache.org/schema/spring}dataFormats>,<{http://camel.apache.org/schema/spring}defaultLoadBalancer>,<{http://camel.apache.org/schema/spring}delay>,<{http://camel.apache.org/schema/spring}delete>,<{http://camel.apache.org/schema/spring}description>,<{http://camel.apache.org/schema/spring}dnsServiceDiscovery>,<{http://camel.apache.org/schema/spring}doCatch>,<{http://camel.apache.org/schema/spring}doFinally>,<{http://camel.apache.org/schema/spring}doTry>,<{http://camel.apache.org/schema/spring}dynamicRouter>,<{http://camel.apache.org/schema/spring}el>,<{http://camel.apache.org/schema/spring}endpoint>,<{http://camel.apache.org/schema/spring}enrich>,<{http://camel.apache.org/schema/spring}errorHandler>,<{http://camel.apache.org/schema/spring}etcdServiceDiscovery>,<{http://camel.apache.org/schema/spring}exchangeProperty>,<{http://camel.apache.org/schema/spring}export>,<{http://camel.apache.org/schema/spring}expression>,<{http://camel.apache.org/schema/spring}expressionDefinition>,<{http://camel.apache.org/schema/spring}failover>,<{http://camel.apache.org/schema/spring}fhirJson>,<{http://camel.apache.org/schema/spring}fhirXml>,<{http://camel.apache.org/schema/spring}filter>,<{http://camel.apache.org/schema/spring}flatpack>,<{http://camel.apache.org/schema/spring}fluentTemplate>,<{http://camel.apache.org/schema/spring}from>,<{http://camel.apache.org/schema/spring}get>,<{http://camel.apache.org/schema/spring}globalOption>,<{http://camel.apache.org/schema/spring}globalOptions>,<{http://camel.apache.org/schema/spring}groovy>,<{http://camel.apache.org/schema/spring}gzip>,<{http://camel.apache.org/schema/spring}head>,<{http://camel.apache.org/schema/spring}header>,<{http://camel.apache.org/schema/spring}healthyServiceFilter>,<{http://camel.apache.org/schema/spring}hessian>,<{http://camel.apache.org/schema/spring}hl7>,<{http://camel.apache.org/schema/spring}hystrix>,<{http://camel.apache.org/schema/spring}hystrixConfiguration>,<{http://camel.apache.org/schema/spring}ical>,<{http://camel.apache.org/schema/spring}idempotentConsumer>,<{http://camel.apache.org/schema/spring}inOnly>,<{http://camel.apache.org/schema/spring}inOut>,<{http://camel.apache.org/schema/spring}inputType>,<{http://camel.apache.org/schema/spring}intercept>,<{http://camel.apache.org/schema/spring}interceptFrom>,<{http://camel.apache.org/schema/spring}interceptSendToEndpoint>,<{http://camel.apache.org/schema/spring}jacksonxml>,<{http://camel.apache.org/schema/spring}javaScript>,<{http://camel.apache.org/schema/spring}jaxb>,<{http://camel.apache.org/schema/spring}jibx>,<{http://camel.apache.org/schema/spring}jmxAgent>,<{http://camel.apache.org/schema/spring}json>,<{http://camel.apache.org/schema/spring}jsonpath>,<{http://camel.apache.org/schema/spring}jxpath>,<{http://camel.apache.org/schema/spring}keyStoreParameters>,<{http://camel.apache.org/schema/spring}kubernetesServiceDiscovery>,<{http://camel.apache.org/schema/spring}language>,<{http://camel.apache.org/schema/spring}loadBalance>,<{http://camel.apache.org/schema/spring}loadBalancerConfiguration>,<{http://camel.apache.org/schema/spring}log>,<{http://camel.apache.org/schema/spring}loop>,<{http://camel.apache.org/schema/spring}lzf>,<{http://camel.apache.org/schema/spring}marshal>,<{http://camel.apache.org/schema/spring}method>,<{http://camel.apache.org/schema/spring}mime-multipart>,<{http://camel.apache.org/schema/spring}multiServiceDiscovery>,<{http://camel.apache.org/schema/spring}multiServiceFilter>,<{http://camel.apache.org/schema/spring}multicast>,<{http://camel.apache.org/schema/spring}mvel>,<{http://camel.apache.org/schema/spring}ognl>,<{http://camel.apache.org/schema/spring}onCompletion>,<{http://camel.apache.org/schema/spring}onException>,<{http://camel.apache.org/schema/spring}onFallback>,<{http://camel.apache.org/schema/spring}optimisticLockRetryPolicy>,<{http://camel.apache.org/schema/spring}options>,<{http://camel.apache.org/schema/spring}otherwise>,<{http://camel.apache.org/schema/spring}outputType>,<{http://camel.apache.org/schema/spring}packageScan>,<{http://camel.apache.org/schema/spring}param>,<{http://camel.apache.org/schema/spring}passThroughServiceFilter>,<{http://camel.apache.org/schema/spring}patch>,<{http://camel.apache.org/schema/spring}pgp>,<{http://camel.apache.org/schema/spring}php>,<{http://camel.apache.org/schema/spring}pipeline>,<{http://camel.apache.org/schema/spring}policy>,<{http://camel.apache.org/schema/spring}pollEnrich>,<{http://camel.apache.org/schema/spring}post>,<{http://camel.apache.org/schema/spring}process>,<{http://camel.apache.org/schema/spring}properties>,<{http://camel.apache.org/schema/spring}propertiesFunction>,<{http://camel.apache.org/schema/spring}propertiesLocation>,<{http://camel.apache.org/schema/spring}property>,<{http://camel.apache.org/schema/spring}propertyPlaceholder>,<{http://camel.apache.org/schema/spring}protobuf>,<{http://camel.apache.org/schema/spring}proxy>,<{http://camel.apache.org/schema/spring}put>,<{http://camel.apache.org/schema/spring}python>,<{http://camel.apache.org/schema/spring}random>,<{http://camel.apache.org/schema/spring}recipientList>,<{http://camel.apache.org/schema/spring}redeliveryPolicy>,<{http://camel.apache.org/schema/spring}redeliveryPolicyProfile>,<{http://camel.apache.org/schema/spring}ref>,<{http://camel.apache.org/schema/spring}removeHeader>,<{http://camel.apache.org/schema/spring}removeHeaders>,<{http://camel.apache.org/schema/spring}removeProperties>,<{http://camel.apache.org/schema/spring}removeProperty>,<{http://camel.apache.org/schema/spring}resequence>,<{http://camel.apache.org/schema/spring}responseHeader>,<{http://camel.apache.org/schema/spring}responseMessage>,<{http://camel.apache.org/schema/spring}rest>,<{http://camel.apache.org/schema/spring}restBinding>,<{http://camel.apache.org/schema/spring}restConfiguration>,<{http://camel.apache.org/schema/spring}restContext>,<{http://camel.apache.org/schema/spring}restContextRef>,<{http://camel.apache.org/schema/spring}restProperty>,<{http://camel.apache.org/schema/spring}rests>,<{http://camel.apache.org/schema/spring}ribbonLoadBalancer>,<{http://camel.apache.org/schema/spring}rollback>,<{http://camel.apache.org/schema/spring}roundRobin>,<{http://camel.apache.org/schema/spring}route>,<{http://camel.apache.org/schema/spring}routeBuilder>,<{http://camel.apache.org/schema/spring}routeContext>,<{http://camel.apache.org/schema/spring}routeContextRef>,<{http://camel.apache.org/schema/spring}routes>,<{http://camel.apache.org/schema/spring}routingSlip>,<{http://camel.apache.org/schema/spring}rss>,<{http://camel.apache.org/schema/spring}ruby>,<{http://camel.apache.org/schema/spring}saga>,<{http://camel.apache.org/schema/spring}sample>,<{http://camel.apache.org/schema/spring}script>,<{http://camel.apache.org/schema/spring}secureRandomParameters>,<{http://camel.apache.org/schema/spring}secureXML>,<{http://camel.apache.org/schema/spring}serialization>,<{http://camel.apache.org/schema/spring}serviceCall>,<{http://camel.apache.org/schema/spring}serviceCallConfiguration>,<{http://camel.apache.org/schema/spring}serviceChooserConfiguration>,<{http://camel.apache.org/schema/spring}serviceDiscoveryConfiguration>,<{http://camel.apache.org/schema/spring}serviceExpression>,<{http://camel.apache.org/schema/spring}serviceFilterConfiguration>,<{http://camel.apache.org/schema/spring}setBody>,<{http://camel.apache.org/schema/spring}setExchangePattern>,<{http://camel.apache.org/schema/spring}setFaultBody>,<{http://camel.apache.org/schema/spring}setHeader>,<{http://camel.apache.org/schema/spring}setOutHeader>,<{http://camel.apache.org/schema/spring}setProperty>,<{http://camel.apache.org/schema/spring}simple>,<{http://camel.apache.org/schema/spring}soapjaxb>,<{http://camel.apache.org/schema/spring}sort>,<{http://camel.apache.org/schema/spring}spel>,<{http://camel.apache.org/schema/spring}split>,<{http://camel.apache.org/schema/spring}sql>,<{http://camel.apache.org/schema/spring}sslContextParameters>,<{http://camel.apache.org/schema/spring}staticServiceDiscovery>,<{http://camel.apache.org/schema/spring}sticky>,<{http://camel.apache.org/schema/spring}stop>,<{http://camel.apache.org/schema/spring}stream-config>,<{http://camel.apache.org/schema/spring}streamCaching>,<{http://camel.apache.org/schema/spring}string>,<{http://camel.apache.org/schema/spring}syslog>,<{http://camel.apache.org/schema/spring}tarfile>,<{http://camel.apache.org/schema/spring}template>,<{http://camel.apache.org/schema/spring}terser>,<{http://camel.apache.org/schema/spring}threadPool>,<{http://camel.apache.org/schema/spring}threadPoolProfile>,<{http://camel.apache.org/schema/spring}threads>,<{http://camel.apache.org/schema/spring}thrift>,<{http://camel.apache.org/schema/spring}throttle>,<{http://camel.apache.org/schema/spring}throwException>,<{http://camel.apache.org/schema/spring}tidyMarkup>,<{http://camel.apache.org/schema/spring}to>,<{http://camel.apache.org/schema/spring}toD>,<{http://camel.apache.org/schema/spring}tokenize>,<{http://camel.apache.org/schema/spring}topic>,<{http://camel.apache.org/schema/spring}transacted>,<{http://camel.apache.org/schema/spring}transform>,<{http://camel.apache.org/schema/spring}transformers>,<{http://camel.apache.org/schema/spring}typeFilter>,<{http://camel.apache.org/schema/spring}univocity-csv>,<{http://camel.apache.org/schema/spring}univocity-fixed>,<{http://camel.apache.org/schema/spring}univocity-header>,<{http://camel.apache.org/schema/spring}univocity-tsv>,<{http://camel.apache.org/schema/spring}unmarshal>,<{http://camel.apache.org/schema/spring}validate>,<{http://camel.apache.org/schema/spring}validators>,<{http://camel.apache.org/schema/spring}verb>,<{http://camel.apache.org/schema/spring}weighted>,<{http://camel.apache.org/schema/spring}when>,<{http://camel.apache.org/schema/spring}wireTap>,<{http://camel.apache.org/schema/spring}xmlBeans>,<{http://camel.apache.org/schema/spring}xmljson>,<{http://camel.apache.org/schema/spring}xmlrpc>,<{http://camel.apache.org/schema/spring}xpath>,<{http://camel.apache.org/schema/spring}xquery>,<{http://camel.apache.org/schema/spring}xstream>,<{http://camel.apache.org/schema/spring}xtokenize>,<{http://camel.apache.org/schema/spring}yaml>,<{http://camel.apache.org/schema/spring}zip>,<{http://camel.apache.org/schema/spring}zipFile>,<{http://camel.apache.org/schema/spring}zookeeperServiceDiscovery>
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:743) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:257) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:124) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1148) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:573) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:555) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:75) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:110) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:103) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:161) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:132) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:171) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:152) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.impl.DefaultCamelContext.loadRoutesDefinition(DefaultCamelContext.java:1034) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.spring.boot.RoutesCollector.loadXmlRoutes(RoutesCollector.java:281) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:142) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      ... 16 common frames omitted


      Why isn't it allowing the use of the beans element?



      Now something weird: I move the camel-context.xml file to another folder: spring/camel-context.xml, and import the XML directly in the Spring Boot Application context:



      @SpringBootApplication
      @ImportResource({"classpath:spring/camel-context.xml"})
      public class CamelSpringBootApplication {


      Now it works fine (???).










      share|improve this question













      I have a Spring Boot Apache Camel Application where I define some routes in XML, this is a simplified code:



      Gradle Config:



      buildscript {
      ext {
      springBootVersion = '1.5.14.RELEASE'
      }
      repositories {
      maven { url "https://plugins.gradle.org/m2/" }
      }
      dependencies {
      classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
      }
      }

      apply plugin: 'org.springframework.boot'

      description = """myfuse"""

      ext {
      junitVersion = '5.2.0'
      junitPlatformVersion = '1.2.0'
      fabric8Version = '3.0.11.fuse-000065-redhat-3'
      }

      dependencyManagement {
      imports {
      mavenBom "io.fabric8:fabric8-project-bom-camel-spring-boot:${fabric8Version}"
      }
      }

      dependencies {
      compile 'org.apache.camel:camel-spring-boot-starter',
      "org.springframework.boot:spring-boot-starter-web",
      "org.springframework.boot:spring-boot-starter-actuator"
      testCompile 'es.mma.architecture:mma-arch-test',
      "org.springframework.boot:spring-boot-starter-test",
      'com.github.sbrannen:spring-test-junit5:1.0.2',
      "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
      testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}",
      "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
      }


      camel/camel-context.xml:



      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:camel="http://camel.apache.org/schema/spring"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      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">
      <camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <route id="_route1">
      <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
      <setBody>
      <simple>foo XML message</simple>
      </setBody>
      <log message="${body}"/>
      <to uri="log:fooXmlLog"/>
      </route>
      </camel:camelContext>
      </beans>


      According to the documentation I place the camel-context.xml in a classpath folder named camel.



      When the application starts it throws the following exception (not recognizing the beans element although it is defined in the xml namespace):



      Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.springframework.org/schema/beans", local:"beans"). Expected elements are <{http://camel.apache.org/schema/spring}aggregate>,<{http://camel.apache.org/schema/spring}aop>,<{http://camel.apache.org/schema/spring}asn1>,<{http://camel.apache.org/schema/spring}avro>,<{http://camel.apache.org/schema/spring}barcode>,<{http://camel.apache.org/schema/spring}base64>,<{http://camel.apache.org/schema/spring}batch-config>,<{http://camel.apache.org/schema/spring}bean>,<{http://camel.apache.org/schema/spring}beanPostProcessor>,<{http://camel.apache.org/schema/spring}beanio>,<{http://camel.apache.org/schema/spring}bindy>,<{http://camel.apache.org/schema/spring}blacklistServiceFilter>,<{http://camel.apache.org/schema/spring}boon>,<{http://camel.apache.org/schema/spring}cachingServiceDiscovery>,<{http://camel.apache.org/schema/spring}camelContext>,<{http://camel.apache.org/schema/spring}castor>,<{http://camel.apache.org/schema/spring}choice>,<{http://camel.apache.org/schema/spring}circuitBreaker>,<{http://camel.apache.org/schema/spring}claimCheck>,<{http://camel.apache.org/schema/spring}constant>,<{http://camel.apache.org/schema/spring}consulServiceDiscovery>,<{http://camel.apache.org/schema/spring}consumerTemplate>,<{http://camel.apache.org/schema/spring}contextScan>,<{http://camel.apache.org/schema/spring}convertBodyTo>,<{http://camel.apache.org/schema/spring}crypto>,<{http://camel.apache.org/schema/spring}csv>,<{http://camel.apache.org/schema/spring}customDataFormat>,<{http://camel.apache.org/schema/spring}customLoadBalancer>,<{http://camel.apache.org/schema/spring}customServiceFilter>,<{http://camel.apache.org/schema/spring}dataFormats>,<{http://camel.apache.org/schema/spring}defaultLoadBalancer>,<{http://camel.apache.org/schema/spring}delay>,<{http://camel.apache.org/schema/spring}delete>,<{http://camel.apache.org/schema/spring}description>,<{http://camel.apache.org/schema/spring}dnsServiceDiscovery>,<{http://camel.apache.org/schema/spring}doCatch>,<{http://camel.apache.org/schema/spring}doFinally>,<{http://camel.apache.org/schema/spring}doTry>,<{http://camel.apache.org/schema/spring}dynamicRouter>,<{http://camel.apache.org/schema/spring}el>,<{http://camel.apache.org/schema/spring}endpoint>,<{http://camel.apache.org/schema/spring}enrich>,<{http://camel.apache.org/schema/spring}errorHandler>,<{http://camel.apache.org/schema/spring}etcdServiceDiscovery>,<{http://camel.apache.org/schema/spring}exchangeProperty>,<{http://camel.apache.org/schema/spring}export>,<{http://camel.apache.org/schema/spring}expression>,<{http://camel.apache.org/schema/spring}expressionDefinition>,<{http://camel.apache.org/schema/spring}failover>,<{http://camel.apache.org/schema/spring}fhirJson>,<{http://camel.apache.org/schema/spring}fhirXml>,<{http://camel.apache.org/schema/spring}filter>,<{http://camel.apache.org/schema/spring}flatpack>,<{http://camel.apache.org/schema/spring}fluentTemplate>,<{http://camel.apache.org/schema/spring}from>,<{http://camel.apache.org/schema/spring}get>,<{http://camel.apache.org/schema/spring}globalOption>,<{http://camel.apache.org/schema/spring}globalOptions>,<{http://camel.apache.org/schema/spring}groovy>,<{http://camel.apache.org/schema/spring}gzip>,<{http://camel.apache.org/schema/spring}head>,<{http://camel.apache.org/schema/spring}header>,<{http://camel.apache.org/schema/spring}healthyServiceFilter>,<{http://camel.apache.org/schema/spring}hessian>,<{http://camel.apache.org/schema/spring}hl7>,<{http://camel.apache.org/schema/spring}hystrix>,<{http://camel.apache.org/schema/spring}hystrixConfiguration>,<{http://camel.apache.org/schema/spring}ical>,<{http://camel.apache.org/schema/spring}idempotentConsumer>,<{http://camel.apache.org/schema/spring}inOnly>,<{http://camel.apache.org/schema/spring}inOut>,<{http://camel.apache.org/schema/spring}inputType>,<{http://camel.apache.org/schema/spring}intercept>,<{http://camel.apache.org/schema/spring}interceptFrom>,<{http://camel.apache.org/schema/spring}interceptSendToEndpoint>,<{http://camel.apache.org/schema/spring}jacksonxml>,<{http://camel.apache.org/schema/spring}javaScript>,<{http://camel.apache.org/schema/spring}jaxb>,<{http://camel.apache.org/schema/spring}jibx>,<{http://camel.apache.org/schema/spring}jmxAgent>,<{http://camel.apache.org/schema/spring}json>,<{http://camel.apache.org/schema/spring}jsonpath>,<{http://camel.apache.org/schema/spring}jxpath>,<{http://camel.apache.org/schema/spring}keyStoreParameters>,<{http://camel.apache.org/schema/spring}kubernetesServiceDiscovery>,<{http://camel.apache.org/schema/spring}language>,<{http://camel.apache.org/schema/spring}loadBalance>,<{http://camel.apache.org/schema/spring}loadBalancerConfiguration>,<{http://camel.apache.org/schema/spring}log>,<{http://camel.apache.org/schema/spring}loop>,<{http://camel.apache.org/schema/spring}lzf>,<{http://camel.apache.org/schema/spring}marshal>,<{http://camel.apache.org/schema/spring}method>,<{http://camel.apache.org/schema/spring}mime-multipart>,<{http://camel.apache.org/schema/spring}multiServiceDiscovery>,<{http://camel.apache.org/schema/spring}multiServiceFilter>,<{http://camel.apache.org/schema/spring}multicast>,<{http://camel.apache.org/schema/spring}mvel>,<{http://camel.apache.org/schema/spring}ognl>,<{http://camel.apache.org/schema/spring}onCompletion>,<{http://camel.apache.org/schema/spring}onException>,<{http://camel.apache.org/schema/spring}onFallback>,<{http://camel.apache.org/schema/spring}optimisticLockRetryPolicy>,<{http://camel.apache.org/schema/spring}options>,<{http://camel.apache.org/schema/spring}otherwise>,<{http://camel.apache.org/schema/spring}outputType>,<{http://camel.apache.org/schema/spring}packageScan>,<{http://camel.apache.org/schema/spring}param>,<{http://camel.apache.org/schema/spring}passThroughServiceFilter>,<{http://camel.apache.org/schema/spring}patch>,<{http://camel.apache.org/schema/spring}pgp>,<{http://camel.apache.org/schema/spring}php>,<{http://camel.apache.org/schema/spring}pipeline>,<{http://camel.apache.org/schema/spring}policy>,<{http://camel.apache.org/schema/spring}pollEnrich>,<{http://camel.apache.org/schema/spring}post>,<{http://camel.apache.org/schema/spring}process>,<{http://camel.apache.org/schema/spring}properties>,<{http://camel.apache.org/schema/spring}propertiesFunction>,<{http://camel.apache.org/schema/spring}propertiesLocation>,<{http://camel.apache.org/schema/spring}property>,<{http://camel.apache.org/schema/spring}propertyPlaceholder>,<{http://camel.apache.org/schema/spring}protobuf>,<{http://camel.apache.org/schema/spring}proxy>,<{http://camel.apache.org/schema/spring}put>,<{http://camel.apache.org/schema/spring}python>,<{http://camel.apache.org/schema/spring}random>,<{http://camel.apache.org/schema/spring}recipientList>,<{http://camel.apache.org/schema/spring}redeliveryPolicy>,<{http://camel.apache.org/schema/spring}redeliveryPolicyProfile>,<{http://camel.apache.org/schema/spring}ref>,<{http://camel.apache.org/schema/spring}removeHeader>,<{http://camel.apache.org/schema/spring}removeHeaders>,<{http://camel.apache.org/schema/spring}removeProperties>,<{http://camel.apache.org/schema/spring}removeProperty>,<{http://camel.apache.org/schema/spring}resequence>,<{http://camel.apache.org/schema/spring}responseHeader>,<{http://camel.apache.org/schema/spring}responseMessage>,<{http://camel.apache.org/schema/spring}rest>,<{http://camel.apache.org/schema/spring}restBinding>,<{http://camel.apache.org/schema/spring}restConfiguration>,<{http://camel.apache.org/schema/spring}restContext>,<{http://camel.apache.org/schema/spring}restContextRef>,<{http://camel.apache.org/schema/spring}restProperty>,<{http://camel.apache.org/schema/spring}rests>,<{http://camel.apache.org/schema/spring}ribbonLoadBalancer>,<{http://camel.apache.org/schema/spring}rollback>,<{http://camel.apache.org/schema/spring}roundRobin>,<{http://camel.apache.org/schema/spring}route>,<{http://camel.apache.org/schema/spring}routeBuilder>,<{http://camel.apache.org/schema/spring}routeContext>,<{http://camel.apache.org/schema/spring}routeContextRef>,<{http://camel.apache.org/schema/spring}routes>,<{http://camel.apache.org/schema/spring}routingSlip>,<{http://camel.apache.org/schema/spring}rss>,<{http://camel.apache.org/schema/spring}ruby>,<{http://camel.apache.org/schema/spring}saga>,<{http://camel.apache.org/schema/spring}sample>,<{http://camel.apache.org/schema/spring}script>,<{http://camel.apache.org/schema/spring}secureRandomParameters>,<{http://camel.apache.org/schema/spring}secureXML>,<{http://camel.apache.org/schema/spring}serialization>,<{http://camel.apache.org/schema/spring}serviceCall>,<{http://camel.apache.org/schema/spring}serviceCallConfiguration>,<{http://camel.apache.org/schema/spring}serviceChooserConfiguration>,<{http://camel.apache.org/schema/spring}serviceDiscoveryConfiguration>,<{http://camel.apache.org/schema/spring}serviceExpression>,<{http://camel.apache.org/schema/spring}serviceFilterConfiguration>,<{http://camel.apache.org/schema/spring}setBody>,<{http://camel.apache.org/schema/spring}setExchangePattern>,<{http://camel.apache.org/schema/spring}setFaultBody>,<{http://camel.apache.org/schema/spring}setHeader>,<{http://camel.apache.org/schema/spring}setOutHeader>,<{http://camel.apache.org/schema/spring}setProperty>,<{http://camel.apache.org/schema/spring}simple>,<{http://camel.apache.org/schema/spring}soapjaxb>,<{http://camel.apache.org/schema/spring}sort>,<{http://camel.apache.org/schema/spring}spel>,<{http://camel.apache.org/schema/spring}split>,<{http://camel.apache.org/schema/spring}sql>,<{http://camel.apache.org/schema/spring}sslContextParameters>,<{http://camel.apache.org/schema/spring}staticServiceDiscovery>,<{http://camel.apache.org/schema/spring}sticky>,<{http://camel.apache.org/schema/spring}stop>,<{http://camel.apache.org/schema/spring}stream-config>,<{http://camel.apache.org/schema/spring}streamCaching>,<{http://camel.apache.org/schema/spring}string>,<{http://camel.apache.org/schema/spring}syslog>,<{http://camel.apache.org/schema/spring}tarfile>,<{http://camel.apache.org/schema/spring}template>,<{http://camel.apache.org/schema/spring}terser>,<{http://camel.apache.org/schema/spring}threadPool>,<{http://camel.apache.org/schema/spring}threadPoolProfile>,<{http://camel.apache.org/schema/spring}threads>,<{http://camel.apache.org/schema/spring}thrift>,<{http://camel.apache.org/schema/spring}throttle>,<{http://camel.apache.org/schema/spring}throwException>,<{http://camel.apache.org/schema/spring}tidyMarkup>,<{http://camel.apache.org/schema/spring}to>,<{http://camel.apache.org/schema/spring}toD>,<{http://camel.apache.org/schema/spring}tokenize>,<{http://camel.apache.org/schema/spring}topic>,<{http://camel.apache.org/schema/spring}transacted>,<{http://camel.apache.org/schema/spring}transform>,<{http://camel.apache.org/schema/spring}transformers>,<{http://camel.apache.org/schema/spring}typeFilter>,<{http://camel.apache.org/schema/spring}univocity-csv>,<{http://camel.apache.org/schema/spring}univocity-fixed>,<{http://camel.apache.org/schema/spring}univocity-header>,<{http://camel.apache.org/schema/spring}univocity-tsv>,<{http://camel.apache.org/schema/spring}unmarshal>,<{http://camel.apache.org/schema/spring}validate>,<{http://camel.apache.org/schema/spring}validators>,<{http://camel.apache.org/schema/spring}verb>,<{http://camel.apache.org/schema/spring}weighted>,<{http://camel.apache.org/schema/spring}when>,<{http://camel.apache.org/schema/spring}wireTap>,<{http://camel.apache.org/schema/spring}xmlBeans>,<{http://camel.apache.org/schema/spring}xmljson>,<{http://camel.apache.org/schema/spring}xmlrpc>,<{http://camel.apache.org/schema/spring}xpath>,<{http://camel.apache.org/schema/spring}xquery>,<{http://camel.apache.org/schema/spring}xstream>,<{http://camel.apache.org/schema/spring}xtokenize>,<{http://camel.apache.org/schema/spring}yaml>,<{http://camel.apache.org/schema/spring}zip>,<{http://camel.apache.org/schema/spring}zipFile>,<{http://camel.apache.org/schema/spring}zookeeperServiceDiscovery>
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:743) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:257) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:124) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1148) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:573) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:555) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:75) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:110) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:103) ~[jaxb-core-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:161) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:132) ~[jaxb-impl-2.2.11.redhat-4.jar:2.2.11.redhat-4]
      at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:171) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:152) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.impl.DefaultCamelContext.loadRoutesDefinition(DefaultCamelContext.java:1034) ~[camel-core-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.spring.boot.RoutesCollector.loadXmlRoutes(RoutesCollector.java:281) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:142) ~[camel-spring-boot-2.21.0.fuse-000112-redhat-3.jar:2.21.0.fuse-000112-redhat-3]
      ... 16 common frames omitted


      Why isn't it allowing the use of the beans element?



      Now something weird: I move the camel-context.xml file to another folder: spring/camel-context.xml, and import the XML directly in the Spring Boot Application context:



      @SpringBootApplication
      @ImportResource({"classpath:spring/camel-context.xml"})
      public class CamelSpringBootApplication {


      Now it works fine (???).







      spring-boot apache-camel jbossfuse fuse






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 9:24









      codependent

      7,042955118




      7,042955118
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I found the answer in http://camel.apache.org/spring-boot.html:




          The XML files should be Camel XML routes (not CamelContext)




          So I changed the route definition to the following and problem solved:



          <?xml version="1.0" encoding="UTF-8"?>
          <route id="_route1" xmlns="http://camel.apache.org/schema/spring">
          <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
          <setBody>
          <simple>foo XML message</simple>
          </setBody>
          <log message="${body}"/>
          <to uri="log:fooXmlLog"/>
          </route>





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389822%2fspring-boot-apache-camel-red-hat-fuse-application-throws-exception-for-xml-def%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I found the answer in http://camel.apache.org/spring-boot.html:




            The XML files should be Camel XML routes (not CamelContext)




            So I changed the route definition to the following and problem solved:



            <?xml version="1.0" encoding="UTF-8"?>
            <route id="_route1" xmlns="http://camel.apache.org/schema/spring">
            <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
            <setBody>
            <simple>foo XML message</simple>
            </setBody>
            <log message="${body}"/>
            <to uri="log:fooXmlLog"/>
            </route>





            share|improve this answer


























              0














              I found the answer in http://camel.apache.org/spring-boot.html:




              The XML files should be Camel XML routes (not CamelContext)




              So I changed the route definition to the following and problem solved:



              <?xml version="1.0" encoding="UTF-8"?>
              <route id="_route1" xmlns="http://camel.apache.org/schema/spring">
              <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
              <setBody>
              <simple>foo XML message</simple>
              </setBody>
              <log message="${body}"/>
              <to uri="log:fooXmlLog"/>
              </route>





              share|improve this answer
























                0












                0








                0






                I found the answer in http://camel.apache.org/spring-boot.html:




                The XML files should be Camel XML routes (not CamelContext)




                So I changed the route definition to the following and problem solved:



                <?xml version="1.0" encoding="UTF-8"?>
                <route id="_route1" xmlns="http://camel.apache.org/schema/spring">
                <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
                <setBody>
                <simple>foo XML message</simple>
                </setBody>
                <log message="${body}"/>
                <to uri="log:fooXmlLog"/>
                </route>





                share|improve this answer












                I found the answer in http://camel.apache.org/spring-boot.html:




                The XML files should be Camel XML routes (not CamelContext)




                So I changed the route definition to the following and problem solved:



                <?xml version="1.0" encoding="UTF-8"?>
                <route id="_route1" xmlns="http://camel.apache.org/schema/spring">
                <from uri="timer://fooXml?delay={{timer.xml.delay}}&amp;period={{timer.xml.period}}"/>
                <setBody>
                <simple>foo XML message</simple>
                </setBody>
                <log message="${body}"/>
                <to uri="log:fooXmlLog"/>
                </route>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 '18 at 9:33









                codependent

                7,042955118




                7,042955118






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389822%2fspring-boot-apache-camel-red-hat-fuse-application-throws-exception-for-xml-def%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                    Alcedinidae

                    Can an atomic nucleus contain both particles and antiparticles? [duplicate]