users@jaxb.java.net

Re: JAXB marshal error: <my.genpkg.class> nor any of its super class is known to this context

From: ddoTwo <ddodini_at_gmail.com>
Date: Fri, 1 Oct 2010 14:45:40 -0700 (PDT)

Testing post. My reply is resulting in HTTP 500 error


Wolfgang Laun-2 wrote:
>
> The information you provide is insufficient for diagnosis. The error
> message
> refers to a class "my.genpkg.class", which is impossible; you have
> JAXBContext.newInstance("my.pkg.name");
> where the package name in JAXBContext.newInstance does not refer to the
> package of that class.
>
> -W
>
>
> On 1 October 2010 18:26, ddoTwo <ddodini_at_gmail.com> wrote:
>
>>
>> Hi,
>>
>> I am do a poc with JAXB. I have successfully compiled my java objects
>> from
>> my xsd. There are 365 Java objects that have been generated.
>>
>> The next step is to populate my Java object in memory and then marshal it
>> to
>> xml. (From there I can test unmarshalling). When I do this I get the
>> following exception:
>>
>> "javax.xml.bind. JAXBException <my.genpkg.class> nor any of its super
>> class
>> is known to this context"
>>
>> I am using Java6 and pointing to the
>> com.sun.xml.bind.v2.runtime.JAXBContextImpl. The ObjectFactory for my
>> generated root context was created along with the classes representing
>> the
>> types in the xsd(s).
>>
>> I am pointing to the package where the ObjectFactory and my generated
>> classes. I am not sure what is going on. I am using ant. I include the
>> code
>> below where I generated my classes, (in Ant), and my marshalling code.
>>
>> Any tips would be greatly appreciated.
>>
>> The generation ant code:
>> <target name="bindOtaSchema">
>> <exec executable="${myEnv.JAVA_HOME}/bin/xjc.exe">
>> <arg value="-d"/>
>> <arg value="${src.dir}"/>
>> <arg value="-p"/>
>> <arg value="${my.pkg.name}"/>
>> <arg value="${htng.schema.dir}/mySchema.xsd"/>
>> </exec>
>> </target>
>>
>> The code to do the marshalling:
>>
>> private void marshallXml(MyRootObj rootObj) {
>> try {
>> JAXBContext jc = JAXBContext.newInstance("my.pkg.name");
>> Marshaller m = jc.createMarshaller();
>> m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> Boolean.TRUE);
>> m.marshal(rootObj, System.out);
>> } catch (JAXBException jaxbe) {
>> jaxbe.printStackTrace();
>> }
>> }
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/JAXB-marshal-error%3A-%3Cmy.genpkg.class%3E-nor-any-of-its-super-class-is-known-to-this-context-tp29859106p29859106.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>

-- 
View this message in context: http://old.nabble.com/JAXB-marshal-error%3A-%3Cmy.genpkg.class%3E-nor-any-of-its-super-class-is-known-to-this-context-tp29859106p29860804.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.