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

  • SEARCH
  • Home
  • 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 8064601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:25:07+00:00 2026-06-05T11:25:07+00:00

I have an input xml and corresponding java classes as the following. <Address> <name>name</name>

  • 0

I have an input xml and corresponding java classes as the following.

<Address>
  <name>name</name>
  <streetName>street</streetName>
<Address>

public class Address {
    private String name;
    //getter and setter here
}

public class Home extends Address {
    private String streetName;
    // getter and setter follows
}

And I tried to unmarshal the xml like the following

import com.thoughtworks.xstream.XStream;

public class Main {
    public static void main(String as[]) {
        XStream xstream = new XStream();
        String str = "<com.xstream.inheritance.Address> <name>name</name> <streetName>street</streetName>"
                + "</com.xstream.inheritance.Address>";
        Address address1 = (Address) xstream.fromXML(str);
        System.out.println(address1.getName());
    }
}

I got an exception saying
Exception in thread “main”

com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field com.xstream.inheritance.Address.streetName
---- Debugging information ----
field               : streetName
class               : com.xstream.inheritance.Address
required-type       : com.xstream.inheritance.Address
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                : /com.xstream.inheritance.Address/streetName
version             : null

Why did I get this exception?

  • 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-05T11:25:08+00:00Added an answer on June 5, 2026 at 11:25 am

    The XML is missing the “class” attribute which would point to your extended class. So the output would be like this:

    <com.xstream.inheritance.Address class="com.xstream.inheritance.Home">
     <name>name</name>
     <streetName>street</streetName>
    </com.xstream.inheritance.Address>
    

    This is done automatically by XStream.

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

Sidebar

Related Questions

I have the following input XML: <root age=1> <description>some text</description> <section> <item name=a> <uuid>1</uuid>
I have a input file Main.xml <?xml version=1.0 encoding=utf-8 ?> <Employees> <Employee> <id name=id>1</id>
I have the following input XML: figure2 Support Support Support I need to hide
in input XML I have a tag <name>Sample '</name> in XSL I transform this
We have in input an XML like following: <R> <MT N=folder V=Folder1\Subfolder1 /> <MT
I have an XML input as shown below: <?xml version=1.0 encoding=utf-8?> <Content> <section name=FileID/>
I have the following XML input file: <mappings> <mapping> <key>6718</key> <value attribute=content_type>Info Page</value> </mapping>
I have this use case of an xml file with input like Input: <abc
I have the following XML <ns0:Root xmlns:ns0=http://Map_Sample.Input_Schema> <Number1> </Number1> <Number2>11</Number2> <Number3>12</Number3> </ns0:Root> In this
I have written xml file which contains html tags as element like <component> <input

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.