users@jaxb.java.net

problems marshalling object throwing a nor any of its super class is known to this context exception

From: swe <erik_swe_at_yahoo.com>
Date: Sun, 26 Oct 2008 04:49:54 -0700 (PDT)

Hi,

I'm trying to make use of XmlJavaTypeAdapter in JAXB(2.0.3) but I can't
figure out why I'm getting the following exception


    Exception in thread "main" javax.xml.bind.MarshalException
     - with linked exception:
    [javax.xml.bind.JAXBException: [Ldomain.DummyType; nor any of its super
class is known to this context]
            at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:295)
            at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:221)
            at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:77)
            at
utils.TransformationEngineImpl.convert(TransformationEngineImpl.java:27)
            at
utils.TransformationEngineImpl.main(TransformationEngineImpl.java:64)
        




The problem is that I'm not able to return an Array of type domain.DummyType
when I marshall the object. However, only returning a DummyType object works
fine. I've also tried to return a List, Collection etc. but I'm getting
exceptions thrown for all java types. Seems that the context is only aware
of the objects I've defined in my jaxb.index file.

     
    public DummyType[] marshal(Object arg0) throws Exception {
    Map courses = (Map)arg0;
    DummyType type [] = new DummyType[4];
                    
    // populate type array
    DummyType d = new DummyType("text goes here");
    return type;
    }
       



This is the lines of code that does the marshalling


      JAXBContext context = JAXBContext.newInstance("domain");
     Marshaller marshaller = context.createMarshaller();
                    
     StringWriter sw = new StringWriter();
     marshaller.marshal(o, sw);
     
      
Many thanks
Sven
-- 
View this message in context: http://www.nabble.com/problems-marshalling-object-throwing-a-nor-any-of-its-super-class-is-known-to-this-context-exception-tp20172605p20172605.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.