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 7530089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:48:58+00:00 2026-05-30T04:48:58+00:00

I have a relatively simple package of 8 Java classes generated from an XML

  • 0

I have a relatively simple package of 8 Java classes generated from an XML schema using JAXB XJC. I also have a utility class to marshal and unmarshal instances of the class.

This works

The utility class can successfully unmarshal a valid XML document into an instance of the ‘root’ class WordMergeInfo. For example this works fine:

    JAXBContext jc = JAXBContext.newInstance(WordMergeInfo.class);
    Unmarshaller um = jc.createUnmarshaller();
    return (WordMergeInfo)um.unmarshal(inputStream);

This doesn’t work

But marshalling to a string fails. In this code:

    JAXBContext jc = JAXBContext.newInstance(WordMergeInfo.class);
    Marshaller m = jc.createMarshaller();
    StringWriter writer = new StringWriter();
    m.marshal(m, writer);
    return writer.toString();

the call to Marshaller.marshal fails with the following error:

javax.xml.bind.JAXBException: class com.sun.xml.bind.v2.runtime.MarshallerImpl nor any of its super class is known to this context.
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)

As I understand it, nor any of its super class is known to this context means that a JAXB class needed for marshalling cannot be found. So why can’t one of the JAXB implementation classes be found, when the same class is in the stack trace?

Context

This error showed up in a unit test of my class, run under Maven. The dependencies are:

  • javax.xml.bind:jaxb-api:2.1
  • com.sun.xml.bind:jaxb-impl:2.1.13

I got the same error with earlier versions of these (2.0 and 2.0.3, respectively).

The Maven test class path is:

C:\Users\mstra.CUSTMAN\Workspace\DARTCorrModule\xml\target\test-classes
C:\Users\mstra.CUSTMAN\Workspace\DARTCorrModule\xml\target\classes
C:\Users\mstra.CUSTMAN\.m2\repository\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar
C:\Users\mstra.CUSTMAN\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar
C:\Users\mstra.CUSTMAN\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar
C:\Users\mstra.CUSTMAN\.m2\repository\com\sun\xml\bind\jaxb-impl\2.1.13\jaxb-impl-2.1.13.jar
C:\Users\mstra.CUSTMAN\.m2\repository\junit\junit\4.8.2\junit-4.8.2.jar
C:\Users\mstra.CUSTMAN\.m2\repository\org\mockito\mockito-all\1.8.5\mockito-all-1.8.5.jar
C:\Users\mstra.CUSTMAN\.m2\repository\javax\ejb\ejb-api\3.0\ejb-api-3.0.jar
C:\Users\mstra.CUSTMAN\.m2\repository\org\slf4j\slf4j-api\1.6.4\slf4j-api-1.6.4.jar

Any insight is appreciated.

  • 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-05-30T04:48:59+00:00Added an answer on May 30, 2026 at 4:48 am

    nor any of its super class is known to this context

    This means that the class is not registered as a marshallable class in the JAXB context.

    Your error is on this line:

    m.marshal(m, writer);
    

    You are trying to marshal the marshaller itself. You probably meant to marshal a WordMergeInfo object.

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

Sidebar

Related Questions

I'm using WPF with .NET 3.0. I have a relatively simple DataTemplate defined as
I am using Spring 3.0.2. I have two relatively simple bean definitions. One has
I have a set of classes and interfaces which have a relatively simple hierarchy,
I'm doing some relatively simple I/O in Java. I have a .txt files that
I have a relatively simple site that I'm working up for an intranet environment.
We have are relatively simple Reporting Services report that our users commonly export to
I have a relatively simple form which asks a variety of questions. One of
I have a relatively simple select statement in a VB6 program that I have
I have a relatively simple application which I need to make native Mac OSX
I have a relatively simple query joining two tables. The Where criteria can be

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.