Hi,

with Castor 1.3, I'd recommend to use code like this:

XMLContext context = new XMLContext();
MappingTool tool = context.createMappingTool();
tool.addClass(Test.class);
OutputStream file = new FileOutputStream("gen_mapping.xml" );
Writer writer = new OutputStreamWriter(file);
tool.write(writer);

Not 100% sure whether this would work with 1.2 as well.

Regards
Werner

Andrew Irwin wrote:
> Hi,
> 
> Castor Version - 1.2
> Java - 1.6
> 
> I am trying to use the Mapping Tool to generate the Mapping XML file. 
> The code I am using is:
> 
>             MappingTool tool = new MappingTool();
>             tool.addClass(Test.class);
>             OutputStream file = new FileOutputStream("gen_mapping.xml" );
>             Writer writer = new OutputStreamWriter(file);
>             tool.write(writer);
> 
> However, when attempting to add a class using tool.addClass a
> NullPointer Exception is thrown.  See stack trace below:
> 
> java.lang.NullPointerException
>     at org.exolab.castor.tools.MappingTool.addClass(MappingTool.java:259)
>     at org.exolab.castor.tools.MappingTool.addClass(MappingTool.java:237)
>     at pd.impl.XMLBindingTest.main(XMLBindingTest.java:48)
> 
> 
> Any help on how to resolve this would be grateful.
> 
> Thanks,
> 
> Andrew

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to