0

I am trying to convert an XML payload to json. It is passed as a request to a post rest service created in spring boot application, using apache camel.

This is my code:

package com.example.XMLValidator;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.dataformat.xmljson.XmlJsonDataFormat;


import core.ErrorProcessor;

@Component
public class XMLValidatorRestService extends RouteBuilder{
    
        @Override
        public void configure() throws Exception {
            
            onException(Exception.class).handled(true)
            .process(new ErrorProcessor());
            XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
            

            rest("/xmlValidator/{ebmName}")//.produces("application.json") 
            .post()
            
            .to("direct:xmlValidator");
 
            from("direct:xmlValidator")
            .marshal(xmlJsonFormat)
            .choice()
            .when(header("ebmName").isEqualTo("pers.marriage.ebm.marrInfo_1.0"))
            .to("validator:file:D:/Users/User/Downloads/retail.prod.ebm.subCatgInfo_1.0.xsd")
                
      .log("${body}");
      
         
            
         
        }
        
}

However I am getting this error:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.camel.spring.boot.util.OnHierarchicalPropertiesCondition.getMatchOutcome(OnHierarchicalPropertiesCondition.java:54)

The following method did not exist:

    org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator.evaluate(Lorg/springframework/core/env/Environment;Ljava/util/Collection;)

The class hierarchy was loaded from the following locations:

    org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator: file:/C:/Users/User/.m2/repository/org/apache/camel/camel-spring-boot/2.23.4/camel-spring-boot-2.23.4.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator

Any idea how to solve this issue? Thank you

Jenny
  • 375
  • 4
  • 6
  • 25

0 Answers0