Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Jaxb dataFormat don't works in spring DSL

    Posted on

    I created a route to make unmarshall from xml files to java objects, however when I execute this one, the error below occur.

    Caused by: javax.xml.bind.JAXBException: "com.redhat.training.model" doesnt contain ObjectFactory.class or jaxb.index
    

    I don't understand the reason of problem because I created an annotated class basead in the JB421 course.

    package com.redhat.training.model;
    
    import java.io.Serializable;
    
    import javax.xml.bind.annotation.*;
    
    @XmlRootElement
    @XmlAccessorType(XmlAccessType.FIELD)
    public class Order implements Serializable{
    
        private static final long serialVersionUID = 5851038813219503043L;
        @XmlAttribute
        private String id;
        @XmlAttribute
        private String description;
        @XmlAttribute
        private double value;   
        @XmlAttribute
        private double tax;
        public String getId() {
            return id;
        }
        public void setId(String id) {
            this.id = id;
        }
        public String getDescription() {
            return description;
        }
        public void setDescription(String description) {
            this.description = description;
        }
        public double getValue() {
            return value;
        }
        public void setValue(double value) {
            this.value = value;
        }
        public double getTax() {
            return tax;
        }
        public void setTax(double tax) {
            this.tax = tax;
        }   
    }
    

    after that, I made a reference to this class using the tag in the camelContext.xml file.
    I don't find any reference that I need to create an instance of ObjectFactory or put a file jaxb.index in the same package of annotated classes.

    
    
    
        
    
        
    
            
                
            
    
            
                
                 
                
            
    
        
    
    
    

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat