snimavat / nimble

Nimble Security Grails Plugin
Other
15 stars 19 forks source link

Getting NullPointerException in AuthController #22

Closed JohnM1991 closed 11 years ago

JohnM1991 commented 11 years ago

After login, at line 62: userService.createLoginRecord(request) in grails-app\controllers\grails\plugin\nimble\core\AuthController.groovy I get a NullPointerException:

URI
    /MyApp/auth/signin
Class
    java.lang.NullPointerException
Message
    Cannot invoke method createLoginRecord() on null object

It seems as if UserService isn't injected and thus is null. Nevertheless, UserService.groovy is present in \target\work\plugins\nimble-0.5.1\grails-app\services\grails\plugin\nimble\core.

I tried in BuildConfig.groovy both

plugins {
    // ...
    compile ":nimble:0.5.2"
}

and also :nimble:0.5.1.

It is likely some issue with my configuration / project, but I think I did everything according to instructions, and all my other plugins work fine.

I'm using Grails 2.3.0.RC1.

Please advise.

snimavat commented 11 years ago

@JohnMurdoch can you attach the bug report (grails bug-report)

JohnM1991 commented 11 years ago

NullPointerException occurred when processing request: [POST] /NimbleTest/auth/s ignin - parameters: username: admin targetUri: /main password: *** Cannot invoke method createLoginRecord() on null object. Stacktrace follows: java.lang.NullPointerException: Cannot invoke method createLoginRecord() on null object at grails.plugin.nimble.core.AuthController.signin(AuthController.groovy :62) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(Abstrac tShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiro Filter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallab le.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable .java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(Delegating Subject.java:380) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(Abs tractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerReq uestFilter.java:125) at org.apache.shiro.grails.SavedRequestFilter.doFilter(SavedRequestFilte r.java:55) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:908) at java.lang.Thread.run(Thread.java:662)

snimavat commented 11 years ago

@JohnMurdoch I can not reproduce, I tried with 2.3.0-RC2 in a fresh application. Do you have another class/service with name UserService in your app ? Enabling logging for spring may uncover some dependency injection issue in your app. if you can attach a bug report that would be great.

JohnM1991 commented 11 years ago

grails> bug-report | Created bug-report ZIP at D:\temp\nimbleTest\NimbleTest/NimbleTest-bug-report- 04092013.zip grails>

https://www.dropbox.com/s/blmpiigo2iyicxp/NimbleTest-bug-report-04092013.zip

I hope you get access to it.

Maybe it is a 2.3.0-RC1 problem. I will try downloading RC2 and see if that helps.

JohnM1991 commented 11 years ago

Probably cannot be reproduced with RC2. Apologies for not trying it in the first place.

snimavat commented 11 years ago

Glad to know it worked for you.