greenlaw110/play-morphia — Issue #64: Using Morphia with POJO-mapping or CRUD gives Nullpointer
Author: blockmar
Created: 2012-01-31 09:32:48+00:00
State: open

When I try to use Morphia-based model objects with the Controller pojo-mapping I get a NullpointerException when navigating to the page. See below.

Oops: NullPointerException

```java
An unexpected error occured caused by exception NullPointerException: null

play.exceptions.UnexpectedException: Unexpected Error
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:258)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.modules.morphia.MorphiaPlugin.bind(MorphiaPlugin.java:577)
at play.PlayPlugin.bind(PlayPlugin.java:68)
at play.plugins.PluginCollection.bind(PluginCollection.java:534)
at play.data.binding.Binder.bind(Binder.java:111)
at play.mvc.ActionInvoker.getActionMethodArgs(ActionInvoker.java:642)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
... 1 more
```

Model object:

```java
package models;

import play.modules.morphia.Model;

public class Registerform extends Model {

public String name;
public String alias;
public String password1;
public String password2;

}
```

Controller method:

```java
package controllers;

import models.forms.Registerform;
import play.mvc.Controller;

public class Register extends Controller {

public static void index(Registerform form) {
if(form != null){ System.out.println(form.name); }
render();
}
}
```