Announcement Announcement Module
Collapse
No announcement yet.
IllegalAnnotationException in Jaxb context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IllegalAnnotationException in Jaxb context

    Hello,

    I'm having a problem with JAXB. Our company integrates with one of our partners which uses a Ruby on Rails application with a RESTful web interface. I wrote an interface for our system that uses JAXB to un/marshal requests from / to their system. I got the code compiling, running and tested, and right before I'm about to deploy the new version of our system, I find that maven can't compile the code (hadn't tried to package everything up with maven with the new code before now) and any time I try to run the application, I get errors saying that my class is abstract. This is the class.
    Code:
    package com.mypackage.schema;
    
    import java.math.BigDecimal;
    import javax.xml.bind.JAXBElement;
    import javax.xml.bind.annotation.XmlAccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlElementRef;
    import javax.xml.bind.annotation.XmlType;
    import javax.xml.datatype.XMLGregorianCalendar;
    
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "Cheque", propOrder = {
        "batchNo",
        "chequeNo",
        "clearDate",
        "id",
        "memo",
        "notes",
        "payeeCity",
        "payeeCountry",
        "payeeFirst",
        "payeeLast",
        "payeePostal",
        "payeeRegion",
        "payeeStreet",
        "payment",
        "printDate",
        "state",
        "stopReason",
        "userId",
        "userNotes",
        "voidDate",
        "reference1",
        "reference2",
        "reference3",
        "reference4"
    })
    public class Cheque {
    
        @XmlElement(name = "batch-no", required = true)
        protected String batchNo;
        @XmlElementRef(name = "cheque-no", type = JAXBElement.class)
        protected JAXBElement<Integer> chequeNo;
        @XmlElementRef(name = "clear-date", type = JAXBElement.class)
        protected JAXBElement<XMLGregorianCalendar> clearDate;
        protected Integer id;
        @XmlElement(required = true)
        protected String memo;
        @XmlElement(required = true)
        protected String notes;
        @XmlElement(name = "payee-city", required = true)
        protected String payeeCity;
        @XmlElement(name = "payee-country", required = true)
        protected String payeeCountry;
        @XmlElement(name = "payee-first", required = true)
        protected String payeeFirst;
        @XmlElement(name = "payee-last", required = true)
        protected String payeeLast;
        @XmlElement(name = "payee-postal", required = true)
        protected String payeePostal;
        @XmlElement(name = "payee-region", required = true, nillable = true)
        protected String payeeRegion;
        @XmlElement(name = "payee-street", required = true)
        protected String payeeStreet;
        @XmlElement(required = true)
        protected BigDecimal payment;
        @XmlElementRef(name = "print-date", type = JAXBElement.class)
        protected JAXBElement<XMLGregorianCalendar> printDate;
        protected Integer state;
        @XmlElement(name = "stop-reason", required = true, nillable = true)
        protected String stopReason = "";
        @XmlElement(name = "user-id")
        protected Integer userId;
        @XmlElement(name = "user-notes", required = true, nillable = true)
        protected String userNotes = "";
        @XmlElementRef(name = "void-date", type = JAXBElement.class)
        protected JAXBElement<XMLGregorianCalendar> voidDate;
        protected String reference1;
        protected String reference2;
        protected String reference3;
        protected String reference4;
    
        //Property Accessors omitted for clarity
    }
    The error I get when trying to compile with Maven2 is :
    Code:
    [INFO] Compilation failure
    
    I:\Documents and Settings\Alex\workspace\myproject\src\main\java\com\mypackage\schema\ObjectFactory.java:[55,15] com.mypackage.schema.Cheque is abstract; cannot be instantiated
    
    I:\Documents and Settings\Alex\workspace\myproject\src\main\java\com\myotherpackage\processors\impl\AmpChequeProcessorImpl.java:[233,19] com.mypackage.schema.Cheque is abstract;
    cannot be instantiated
    Has anybody seen or heard of anything like this before ? It's got me stumped and I've already pulled my hair out and destroyed several mice. I cannot find any explanation for why this could be happening. Any help is truly appreciated.

  • #2
    PS This is all happening the the Spring WS Jaxb2Marshaller

    Comment


    • #3
      Nm, I found the problem. Bottom line : watch where you put XSDs that you don't want compiled when you've got an XmlBeans plugin in your build cycle.

      Comment

      Working...
      X