Recently I got very strange NPE while saving updated entity in Grails application:
All I was doing on line 69 was just calling save() method, object obviously was not null, all fields and dependencies too. Even more - saving another object from same method was perfectly fine, but not one particular.
Finally, I got the reason - object had null in it's version field. Obviously migration was not done properly or it was manually created object in bad schema, but setting version solved my problem easily, but bad error reporting - didn't helped.
java.lang.NullPointerException at com.test.MyController$_closure5.doCall(MyController.groovy:69) at com.test.
MyController
$_closure5.doCall(
MyController
.groovy) at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:149) at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:259) at $Proxy49.forward(Unknown Source) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179) at java.lang.Thread.run(Thread.java:662)
All I was doing on line 69 was just calling save() method, object obviously was not null, all fields and dependencies too. Even more - saving another object from same method was perfectly fine, but not one particular.
Finally, I got the reason - object had null in it's version field. Obviously migration was not done properly or it was manually created object in bad schema, but setting version solved my problem easily, but bad error reporting - didn't helped.
I have this exception in a similar situation
ReplyDeletethank you for sharing this information.
ReplyDelete