java - JAXB unmarshal class that extended of abstract class -


i have 2 classes:

@xmlseealso({recharge.class}) public abstract class base {  private string id;  @xmlelement(name = "system_id", required = true, type = system.class) private system system;  @xmlelement(name = "oper", required = true, type = operation.class) private operation operation;  @xmlelement(name = "date", required = true, type = datetime.class) @xmljavatypeadapter(datetimeadapter.class) private datetime datein;  @xmlelement(name = "idpay", required = true, type = string.class) private string idoutsystem;  @xmlelement(name = "card", required = true, type = string.class) private string carda;     ....  public abstract system getsystem(); public string getid() {         return id; }  public void setid(string id) {         this.id = id; }  public datetime getdatein() {         return datein; }  public void setdatein(datetime datein) {         this.datein = datein; }  }  @xmlaccessortype(xmlaccesstype.field) @xmlrootelement(name = "req") public class recharge extends base {      @override     public system getsystem() {         return system.system_1;     }      @override     public terminal getterminal() {         return terminal.default;      }      @override     public string getcardb() {         return "";     }      @override     public string getsp() {         return "";     } } 

i sended request api:

@post @path("/create") @loggable @produces(mediatype.application_xml) @consumes(mediatype.application_xml) public response handler(recharge recharge) {     return response.status(200).entity(recharge).build(); } 

and exception:

javax.ws.rs.webapplicationexception: com.sun.xml.bind.v2.runtime.illegalannotationsexception: 13 counts of illegalannotationexceptions class has 2 properties of same name "amount"     problem related following location:         @ public java.lang.double com.tt.core.domain.base.base.getamount()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.double com.tt.core.domain.base.base.amount         @ com.tt.core.domain.base.base class has 2 properties of same name "carda"     problem related following location:         @ public java.lang.string com.tt.core.domain.base.base.getcarda()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.string com.tt.core.domain.base.base.carda         @ com.tt.core.domain.base.base class has 2 properties of same name "currency"     problem related following location:         @ public com.tt.core.domain.types.currency com.tt.core.domain.base.base.getcurrency()         @ com.tt.core.domain.base.base     problem related following location:         @ private com.tt.core.domain.types.currency com.tt.core.domain.base.base.currency         @ com.tt.core.domain.base.base class has 2 properties of same name "datein"     problem related following location:         @ public org.joda.time.datetime com.tt.core.domain.base.base.getdatein()         @ com.tt.core.domain.base.base     problem related following location:         @ private org.joda.time.datetime com.tt.core.domain.base.base.datein         @ com.tt.core.domain.base.base class has 2 properties of same name "debit"     problem related following location:         @ public com.tt.core.domain.types.debit com.tt.core.domain.base.base.getdebit()         @ com.tt.core.domain.base.base     problem related following location:         @ private com.tt.core.domain.types.debit com.tt.core.domain.base.base.debit         @ com.tt.core.domain.base.base class has 2 properties of same name "idoutsystem"     problem related following location:         @ public java.lang.string com.tt.core.domain.base.base.getidoutsystem()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.string com.tt.core.domain.base.base.idoutsystem         @ com.tt.core.domain.base.base class has 2 properties of same name "ip"     problem related following location:         @ public java.lang.string com.tt.core.domain.base.base.getip()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.string com.tt.core.domain.base.base.ip         @ com.tt.core.domain.base.base class has 2 properties of same name "login"     problem related following location:         @ public java.lang.string com.tt.core.domain.base.base.getlogin()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.string com.tt.core.domain.base.base.login         @ com.tt.core.domain.base.base class has 2 properties of same name "operation"     problem related following location:         @ public com.tt.core.domain.types.operation com.tt.core.domain.base.base.getoperation()         @ com.tt.core.domain.base.base     problem related following location:         @ private com.tt.core.domain.types.operation com.tt.core.domain.base.base.operation         @ com.tt.core.domain.base.base class has 2 properties of same name "operator"     problem related following location:         @ public com.tt.core.domain.types.operator com.tt.core.domain.base.base.getoperator()         @ com.tt.core.domain.base.base     problem related following location:         @ private com.tt.core.domain.types.operator com.tt.core.domain.base.base.operator         @ com.tt.core.domain.base.base class has 2 properties of same name "phone"     problem related following location:         @ public java.lang.string com.tt.core.domain.base.base.getphone()         @ com.tt.core.domain.base.base     problem related following location:         @ private java.lang.string com.tt.core.domain.base.base.phone         @ com.tt.core.domain.base.base class has 2 properties of same name "terminal"     problem related following location:         @ public abstract com.tt.core.domain.types.terminal com.tt.core.domain.base.base.getterminal()         @ com.tt.core.domain.base.base     problem related following location:         @ private com.tt.core.domain.types.terminal com.tt.core.domain.base.base.terminal         @ com.tt.core.domain.base.base class has 2 properties of same name "userid"     problem related following location:         @ public int com.tt.core.domain.base.base.getuserid()         @ com.tt.core.domain.base.base     problem related following location:         @ private int com.tt.core.domain.base.base.userid         @ com.tt.core.domain.base.base      @ com.sun.jersey.core.provider.jaxb.abstractrootelementprovider.readfrom(abstractrootelementprovider.java:115)     @ com.sun.jersey.spi.container.containerrequest.getentity(containerrequest.java:488)     @ com.sun.jersey.server.impl.model.method.dispatch.entityparamdispatchprovider$entityinjectable.getvalue(entityparamdispatchprovider.java:123)     @ com.sun.jersey.server.impl.inject.injectablevaluesprovider.getinjectablevalues(injectablevaluesprovider.java:46)     @ com.sun.jersey.server.impl.model.method.dispatch.abstractresourcemethoddispatchprovider$entityparamininvoker.getparams(abstractresourcemethoddispatchprovider.java:153)     @ com.sun.jersey.server.impl.model.method.dispatch.abstractresourcemethoddispatchprovider$responseoutinvoker._dispatch(abstractresourcemethoddispatchprovider.java:203)     @ com.sun.jersey.server.impl.model.method.dispatch.resourcejavamethoddispatcher.dispatch(resourcejavamethoddispatcher.java:75)     @ com.sun.jersey.server.impl.uri.rules.httpmethodrule.accept(httpmethodrule.java:302)     @ com.sun.jersey.server.impl.uri.rules.righthandpathrule.accept(righthandpathrule.java:147)     @ com.sun.jersey.server.impl.uri.rules.resourceclassrule.accept(resourceclassrule.java:108)     @ com.sun.jersey.server.impl.uri.rules.righthandpathrule.accept(righthandpathrule.java:147)     @ com.sun.jersey.server.impl.uri.rules.rootresourceclassesrule.accept(rootresourceclassesrule.java:84)     @ com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1511)     @ com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1442)     @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1391)     @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1381)     @ com.sun.jersey.spi.container.servlet.webcomponent.service(webcomponent.java:416)     @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:538)     @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:716)     @ javax.servlet.http.httpservlet.service(httpservlet.java:848)     @ org.eclipse.jetty.servlet.servletholder.handle(servletholder.java:681)     @ org.eclipse.jetty.servlet.servlethandler.dohandle(servlethandler.java:452)     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:138)     @ org.eclipse.jetty.security.securityhandler.handle(securityhandler.java:564)     @ org.eclipse.jetty.server.session.sessionhandler.dohandle(sessionhandler.java:213)     @ org.eclipse.jetty.server.handler.contexthandler.dohandle(contexthandler.java:1083)     @ org.eclipse.jetty.servlet.servlethandler.doscope(servlethandler.java:379)     @ org.eclipse.jetty.server.session.sessionhandler.doscope(sessionhandler.java:175)     @ org.eclipse.jetty.server.handler.contexthandler.doscope(contexthandler.java:1017)     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:136)     @ org.eclipse.jetty.server.handler.handlerwrapper.handle(handlerwrapper.java:97)     @ org.eclipse.jetty.server.server.handle(server.java:445)     @ org.eclipse.jetty.server.httpchannel.handle(httpchannel.java:260)     @ org.eclipse.jetty.server.httpconnection.onfillable(httpconnection.java:225)     @ org.eclipse.jetty.io.abstractconnection$readcallback.run(abstractconnection.java:358)     @ org.eclipse.jetty.util.thread.queuedthreadpool.runjob(queuedthreadpool.java:596)     @ org.eclipse.jetty.util.thread.queuedthreadpool$3.run(queuedthreadpool.java:527)     @ java.lang.thread.run(thread.java:722) ... 

how can make mapping, there no such error ? in not abstract class getters. complemented classes. in exceptions enumerates fields (and 40+ pieces).


Comments