File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Castor NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Castor NullPointerException" Watch "Castor NullPointerException" New topic

Castor NullPointerException

Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 54
I am playing with Castor mapping and I'm getting a NullPointerException. Can anyone help.

My mapping file.

[i]<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"

<class name="Dog" verify-constructable="false">

<map-to xml="MyDog"/>

<field name="name" type="string">
<bind-xml name="DogName" node="element"/>

The Dog Class:[/i]

public class Dog {
private String name;
private String breed;
private String color;
private String size;
public String getName() {
return name;

public void setName(String name) { = name;

public String getBreed() {
return breed;

public void setBreed(String breed) {
this.breed = breed;

public String getColor() {
return color;

public void setColor(String color) {
this.color = color;

public String getSize() {
return size;

public void setSize(String size) {
this.size = size;

public Dog(String name, String breed, String color, String size){ = name;
this.breed = breed;
this.color = color;
this.size = size;


When I run I get this:

Dec 29, 2010 12:55:59 PM org.exolab.castor.xml.Marshaller staticMarshal
INFO: Marshaller called using one of the *static* marshal(Object, *) methods. This will ignore any mapping files as specified. Please consider switching to using Marshaller instances and calling one of the marshal(*) methods.
Dec 29, 2010 12:55:59 PM org.exolab.castor.mapping.Mapping setBaseURL
INFO: dog_mapping.xml is not a URL, trying to convert it to a file URL
Dec 29, 2010 12:55:59 PM org.exolab.castor.mapping.Mapping loadMapping
INFO: Loading mapping descriptors from dog_mapping.xml
at org.exolab.castor.xml.Marshaller.marshal(
at XMLGenerator.generateXML(
at XMLGeratorTest.main(
I agree. Here's the link:
subject: Castor NullPointerException
It's not a secret anymore!