users@jaxb.java.net

RE: Finding JAXB Annotated classes in JAXBContext

From: Michael Mendonca <mmendonca_at_galdosinc.com>
Date: Thu, 17 Nov 2005 18:09:08 -0800

 
Hi All,
 
I want to use a class that I created and annotated, for an existing
schema. I want to use the class for an xml schema element that allows
the xs:any type. Here is a fragment of schema:
 
 
 <xs:complexType name="AttributeAssignmentType" mixed="true">
        <xs:complexContent mixed="true">
            <xs:extension base="xacml:AttributeValueType">
                <xs:attribute name="AttributeId" type="xs:anyURI"
use="required"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="AttributeValueType" mixed="true">
        <xs:complexContent mixed="true">
            <xs:extension base="xacml:ExpressionType">
                <xs:sequence>
                    <xs:any namespace="##any" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="DataType" type="xs:anyURI"
use="required"/>
                <xs:anyAttribute namespace="##any"
processContents="lax"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
However, when I included this class package in the jaxbContext class
with the my existing schema package names, it throws and JAXBException
saying it cannot find the ObjectFactory class.

Here is snipped of my code instantiating the JAXBObject:

jaxbContext=JAXBContext.
newInstance("oasis.xacml._2_0.saml.protocol.schema.os:oasis.names.tc.sam
l._2_0.assertion:oasis.names.tc.saml._2_0.protocol:oasis.names.tc.xacml.
_2_0.context.schema.os:oasis.names.tc.xacml._2_0.policy.schema.os:oasis.
xacml._2_0.saml.assertion.schema.os:com.galdosinc.accesscontrol.pdp.anno
tations");

 

Here is the exception thrown:
java.lang.NoClassDefFoundError:
com.galdosinc.accesscontrol.pdp.annotations.ObjectFactory

Is it possible to use a JAXB User defined annotated class with existing
schema derived classes? The ObjectFactory class is created only when
compiling the schemas with the binding compiler. Is there a way to do
this without using the binding compiler?

Thanks in advance!
Michael