Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Castor NullPointerException  RSS feed

Benjamin Hundley
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!