Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8582225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:14:25+00:00 2026-06-11T21:14:25+00:00

With the following classes, which make up the JSON message structure I transfer to

  • 0

With the following classes, which make up the JSON message structure I transfer to the client side after a JAX-RS call (CXF), I receive

org.apache.cxf.jaxrs.client.ClientWebApplicationException: .Problem with reading the response message, class : class bg.vivacom.sel.dto.SELResponse, ContentType : application/json.
...
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of bg.vivacom.sel.dto.SELDTO, problem: abstract types can only be instantiated with additional type information
 at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@16edbe39; line: 1, column: 157] (through reference chain: bg.vivacom.sel.dto.SELResponse["dto"])

The returned object contains property dto which is an interface

@XmlRootElement(name = "SELResponse")
public class SELResponse implements Serializable{

@XmlElement(name = "corelationID")
private String corelationID;

@XmlElement(name = "responseTimeStamp")  
private String responseTimeStamp;

@XmlElement(name = "respStatusCode")  
private String respStatusCode;

@XmlElement(name = "respStatusMessage")  
private String respStatusMessage;

@XmlElement(name = "processStatus")  
private ProcessStatus processStatus;

@XmlElement(name = "dto")  
private SELDTO dto; 

The interface

public interface SELDTO extends Serializable {

is a way to include a number of different DTOs in my answer depending on the request, such as

@XmlRootElement(name = "customerProfile")
public class CustomerProfileDTO implements SELDTO {

@XmlElement(name = "customerCode")
private String customerCode;
...

and

@XmlRootElement(name = "sms")
public class SmsDTO implements SELDTO {

@XmlElement(name = "From")
private String from;
...

Any ideas how else I have to annotate the classes so that the response can be correctly set to the specific object type. I understand that it requires additional information as at the time it re-creates the dto object it doesn’t know its type so I have tried to annotate the interface as follows:

@XmlSeeAlso({CustomerProfileDTO.class, SmsDTO .class})
public interface SELDTO extends Serializable {

but I still get the issue. Any thoughts would be appreciated it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:14:26+00:00Added an answer on June 11, 2026 at 9:14 pm

    I would recommend using Jackson annotation ‘@JsonTypeInfo’ for this case.

    But if you must use JAXB annotations, use @XmlElements or @XmlElementRefs similar to how you’d use them with JAXB/XML:

         @XmlElements({
                 @XmlElement(type=SubClass1.class, name="sub1"),
                 @XmlElement(type=SubClass2.class, name="sub2")
         })
    

    note that you must include specific mapping to possible subtypes here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which it's domain contain following classes: Courier Customer Food Order
In my project I have the following three interfaces, which are implemented by classes
I've got the following classes: public class Client { public virtual Guid ClientID {
The following WPF UserControl called DataTypeWholeNumber which works. Now I want to make a
I decided to make use of a Hibernate id generator which meet the following
I want to do the following: Make a servlet which would sit in a
I have the following classes: Class called House (which have data regarding the house
I have the following classes in my c++ program: game_entity game_creature which inherits from
I have the following classes generated by the Reverse engineering tool (Entity Framework Power
I have the following classes. I have a object var of Description class. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.