{"id":1918,"date":"2022-08-30T15:20:32","date_gmt":"2022-08-30T15:20:32","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/playframework-crud-nullpointerexception-while-loading-classes-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:32","modified_gmt":"2022-08-30T15:20:32","slug":"playframework-crud-nullpointerexception-while-loading-classes-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/playframework-crud-nullpointerexception-while-loading-classes-collection-of-common-programming-errors\/","title":{"rendered":"playframework CRUD NullPointerException while loading classes-Collection of common programming errors"},"content":{"rendered":"<p>I get this Exception when running a play app that uses the crud module. the strange thing is that when i get this error and i refresh web page the play app works and page is loaded correctly. it seems the play compiler -in DEV mode- can&#8217;t compile CRUD class in first request. i don&#8217;t know why the play compiler in DEV mode frequently fails compiling some classes in my play web app?<\/p>\n<p>i use eclipse IDE &amp; i suspect that eclipse locks some java source files and prevent play from compiling the java sources ; however i&#8217;m not sure of this. There might be some reason that causes play DEV mode compiler to fail &amp; i can&#8217;t figure it out. this issue is happening to me a lot these days while working on a play web app.<\/p>\n<p>what this error means and how to fix it?<\/p>\n<pre><code>ERROR ~ \n\n@69g88ea66\nInternal Server Error (500) for request GET \/\n\nTemplate execution error (In {module:crud}\/app\/views\/tags\/crud\/types.tag around line 3)\nExecution error occured in template {module:crud}\/app\/views\/tags\/crud\/types.tag. Exception raised was NullPointerException : null.\n\nplay.exceptions.TemplateExecutionException\n    at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)\n    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)\n    at play.templates.GroovyTemplate$ExecutableTemplate.invokeTag(GroovyTemplate.java:379)\n    at \/conf\/routes.(line:42)\n    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)\n    at play.templates.Template.render(Template.java:26)\n    at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)\n    at play.mvc.Router.parse(Router.java:162)\n    at play.mvc.Router.load(Router.java:48)\n    at play.mvc.Router.detectChanges(Router.java:219)\n    at Invocation.HTTP Request(Play!)\nCaused by: java.lang.NullPointerException\n    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:266)\n    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:478)\n    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)\n    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:424)\n    at play.classloading.ApplicationClassloader.getAssignableClasses(ApplicationClassloader.java:453)\n    at play.classloading.ApplicationClassloader$getAssignableClasses.call(Unknown Source)\n    at {module:crud}\/app\/views\/tags\/crud\/types.tag.(line:3)\n    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)\n    ... 9 more\n<\/code><\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;UPDATE&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>CRUD routes that i use in routes file. do i need to delete them ?<\/p>\n<pre><code>#{crud.types}\nGET         \/?                                          ${type.controllerClass.name.substring(12).replace('$','')}.index\nGET         \/${type.controllerName}                     ${type.controllerClass.name.substring(12).replace('$','')}.list\nGET         \/${type.controllerName}\/new                 ${type.controllerClass.name.substring(12).replace('$','')}.blank\nGET         \/${type.controllerName}\/{id}                ${type.controllerClass.name.substring(12).replace('$','')}.show\nGET         \/${type.controllerName}\/{id}\/{field}        ${type.controllerClass.name.substring(12).replace('$','')}.attachment\nGET         \/${type.controllerName}\/{id}\/edit           ${type.controllerClass.name.substring(12).replace('$','')}.edit\nPOST        \/${type.controllerName}                     ${type.controllerClass.name.substring(12).replace('$','')}.create\nPOST        \/${type.controllerName}\/{id}                ${type.controllerClass.name.substring(12).replace('$','')}.save\nDELETE      \/${type.controllerName}\/{id}                ${type.controllerClass.name.substring(12).replace('$','')}.delete\n#{\/crud.types}\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-12-02 21:18:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I get this Exception when running a play app that uses the crud module. the strange thing is that when i get this error and i refresh web page the play app works and page is loaded correctly. it seems the play compiler -in DEV mode- can&#8217;t compile CRUD class in first request. i don&#8217;t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1918","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1918"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1918\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}