Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Morphia with POJO-mapping or CRUD gives Nullpointer #64

Open
blockmar opened this issue Jan 31, 2012 · 10 comments
Open

Using Morphia with POJO-mapping or CRUD gives Nullpointer #64

blockmar opened this issue Jan 31, 2012 · 10 comments
Labels

Comments

@blockmar
Copy link

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

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:

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:

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();
    }   
}
@greenlaw110
Copy link
Collaborator

which play version are you using? There are known binding issue with Play
1.2.4.

On Tue, Jan 31, 2012 at 8:32 PM, Anders Blockmar <
reply@reply.github.com

wrote:

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

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:

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:

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();
   }
}

Reply to this email directly or view it on GitHub:
#64

@blockmar
Copy link
Author

I am using Play 1.2.4. I did not make the connection between the issues until now. Probably the same reason.

@greenlaw110
Copy link
Collaborator

Can you try on Play 1.2.3 ?

On Wed, Feb 1, 2012 at 12:36 AM, Anders Blockmar <
reply@reply.github.com

wrote:

I am using Play 1.2.4. I did not make the connection between the issues
until now. Probably the same reason.


Reply to this email directly or view it on GitHub:
#64 (comment)

@blockmar
Copy link
Author

blockmar commented Feb 1, 2012

I tried using 1.2.3 same problem.

This is what I did.

  • Downloaded and unpacked play-1.2.3.
  • Installed play-morphia plugin.
  • Synced dependencies with my old project
  • Re-Eclipsifyed my old project, references changed from 1.2.4 -> 1.2.3
  • Started the project using play-1.2.3.
  • Retested scenario.
  • Got same result/problem.

@blockmar
Copy link
Author

blockmar commented Feb 1, 2012

If you have any tips on how to run play using a custom version of the play-morphia plugin (say in Eclipse for example) I can try to help you with the issue. So far I have forked the repo but haven't figured out how to start play with "my" plugin code.

Do I need to build a plugin jar for each try or can I run it from within my dev env somehow?

@greenlaw110
Copy link
Collaborator

Hi can you try the latest 1.2.7 version?

@greenlaw110
Copy link
Collaborator

Can you send your project package to me? I need to understand how you invoke Register.index(...) method

@blockmar
Copy link
Author

Hi!

Sorry about my mack of answers. I will try to test the tastest version
asap, if I can't test it myself I will send you the project.

redards

Anders

On Sun, Jun 10, 2012 at 6:39 AM, Green Luo <
reply@reply.github.com

wrote:

Can you send your project package to me? I need to understand how you
invoke Register.index(...) method


Reply to this email directly or view it on GitHub:
#64 (comment)

@greenlaw110
Copy link
Collaborator

hi any update here?

@blockmar
Copy link
Author

Hi!

Just tested my old code with play 1.2.5 and the 1.2.10 plugin. Same problem.

I have retired my code (ande the project) in favour of Play 2 a few months ago so this bug is not a problem to me any longer. Please close it since I am unable to dig any further into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants