users@jaxb.java.net

Class Loader issue causing child elements to not be populated.

From: Shawn Kovalchick <bamapookie_at_gmail.com>
Date: Tue, 11 Aug 2009 14:03:23 -0400

Hi,
I'm new to JAXB, and I'm trying to use JAXB to map an XML file to a Java
class. I am using version 2.1.12 (latest version, dated 20090708). The XML
file is organized with a root element called layout with an attribute called
strategy, a child element called conf, and then a number of child elements
below that:

<layout strategy="CVS">
  <conf><!--child elements--></conf>
</layout>

When I unmarshall this file in a separate test class, it works fine. All
the elements are populated and contain the data they are supposed to
contain. When I unmarshall this same file in the applicaton in which it is
to be used, the layout element is created, the attribute is set, but the
child element conf is null. I have reviewed the archives and searched
online for an answer, but have not found anything that resolved the issue.
 I have used the JAXBContext.newInstance method that takes a Class array and
I have used the method that takes a string and a class loader. Both will
create the root element, but not the conf element, and no exception is
thrown.

BTW, we are using the Java Class Loader to load the parent class as a
plugin. When using the method that takes a class loader, we use
this.getClass().getClassLoader(). Using ClassLoader.getSystemClassLoader()
did not work--an exception was thrown immediately indicating the
ObjectFactory.class could not be found.

What else can I check to troubleshoot this, or does anyone have
any suggestions to try?

Thanks,
Shawn K.