Announcement Announcement Module
Collapse
No announcement yet.
NullPointerException in JspViewManager Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NullPointerException in JspViewManager

    Getting the following in my Roo Shell:
    Code:
    NullPointerException at org.springframework.roo.addon.web.mvc.jsp.JspViewManager.addCommonAttributes(JspViewManager.java:408)
    The scenario: I had an application running. Not overly complicated, but with enough elements/customizations I really don't want to have to start over. I had Spring Security on, using the simple Auth Manager provided by default.

    I don't like the idea of storing my User information in a flat-file, especially one that requires you to re-deploy code to add new users. So, I found the following and tried to implement it.

    I copy/pasted most of it, then realized they named the Domain objects Users and Roles, and that the resulting URI for the controllers was "/userses/" and "/roleses/". Being lazy, I whacked the controllers, renamed the domain objects, and re-scaffolded the controllers. This is when I got some error that the ToString of Users was conflicting.

    Reading the article more clearly, I realized they named it "Users" and "Roles" because those are apparently reserved words. I am not sure if this was the problem I was seeing, but again, being lazy, I whacked the Domain Objects and Test objection. For some reason, Roo Shell refused to clean up the aspects, though. Its like it would clean them, then re-generate them again. Also, some of the aspects were "Users", others were "User".

    So, I just whacked those too. Not sure if this was bad or not, but the Roo Shell wasn't having much luck with it. So, I started over, copied the Roo Shell commands from that blog again As-Is, and finished the setup.

    Now I am getting that NullPointerException everytime Roo Shell tries to build the Controller's view elements. The full logs from the Shell are:
    Code:
    Created SRC_MAIN_WEBAPP/WEB-INF/views/roleses
    Created SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Updated SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
    Created SRC_MAIN_WEBAPP/WEB-INF/views/userses
    Created SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Updated SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Undo create SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
    Undo create SRC_MAIN_WEBAPP/WEB-INF/views/userses
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
    Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Undo create SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
    Undo create SRC_MAIN_WEBAPP/WEB-INF/views/roleses
    NullPointerException at org.springframework.roo.addon.web.mvc.jsp.JspViewManager.addCommonAttributes(JspViewManager.java:408)
    The actual Controller Java classes are there. I haven't looked, but I would guess the Aspects are there too. What is missing is all the WAR contents. I Google'ed the error message, but the only thing it came back with was the GIT source link.

    Also, as a side-note, is there a way to force Roo Shell to re-evaluate the codebase? The only way I can get it to "restart" and try again is to close the shell in Eclipse and re-open it.

  • #2
    Actually, just checked. The Aspects are NOT there. I see the UsersController.java, but no UsersController_Roo_Controller.aj. Same with the RolesController.

    Comment


    • #3
      Update 2: I backed out all the changes (Thank you, Time Machine!) to just before I added any of the entities/controllers mentioned in that Blog. I then added them, one by one, exactly how they were in that blog post. Everything up to this point looked great, no errors in Roo Shell at all.

      I redeployed and started up the test server in Eclipse, and things started clean. However, no Users or Roles controllers in the left-side menu. So, I stopped the server, closed the Roo Shell and restarted it. Low and behold, back to the same error:
      Code:
      Created SRC_MAIN_WEBAPP/WEB-INF/views/roleses
      Created SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Updated SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
      Created SRC_MAIN_WEBAPP/WEB-INF/views/userses
      Created SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Updated SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Updated SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Undo create SRC_MAIN_WEBAPP/WEB-INF/views/userses/views.xml
      Undo create SRC_MAIN_WEBAPP/WEB-INF/views/userses
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
      Undo manage SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Undo create SRC_MAIN_WEBAPP/WEB-INF/views/roleses/views.xml
      Undo create SRC_MAIN_WEBAPP/WEB-INF/views/roleses
      NullPointerException at org.springframework.roo.addon.web.mvc.jsp.JspViewManager.addCommonAttributes(JspViewManager.java:408)
      So, what this is telling me is that the problem I was seeing is not an issue with my renaming the domain object, but rather something else. Anyone have any clue what might be happening? If I have too, I'll back out the code to this morning and just table this till later, but I would really like to get the user id's out of the spring config and into a database.

      Comment


      • #4
        Please attached a backup of the project as is so we can reproduce the issue

        Comment


        • #5
          I tried to setup a sample project following the same basic steps, but the sample project worked. The only think I can think of that I did different is that, in the broken project, I started it using Roo Shell 1.1.1 and upgraded midway through to 1.1.4, and in the sample project, 1.1.4 was already there.

          I tried to attach the original project backup file, but when the file finishes uploading, it shows a red '!' and doesn't seem to work. It doesn't indicate what the error is, but I can't seem to get it attached.

          Comment


          • #6
            Can someone tell me how to attach this backup file? I hit the attachment button (paperclip), did "Add File", then "Upload", selected the backup zip. The progress bar goes to 100%, then I get a red '!', but no message telling me what failed. I have tried in both Chrome and Firefox with the same result.

            Edit: It appears that the zip file I tried to upload is too large (170k, max is 90k). I am attaching just the log.roo. Please let me know if there is any other files you might need.

            Attachment
            Attached Files
            Last edited by mbabauer; May 27th, 2011, 06:06 AM.

            Comment


            • #7
              Can anyone reproduce this issue? log.roo was attached.

              Comment


              • #8
                I just ran your attached script and could not see the issue. Here is what I tried. I ran the script you provided with Roo 1.1.1 (no issues) and then started Roo 1.1.4 on the project (no issues, just the expected updates to .aj files and update.jspx). Can you please share how to reproduce this issue in a bit more detail?

                Comment


                • #9
                  I figured it out while trying to reproduce. I had added an Enum manually to one of my entries, but I didn't put the @Enumerated annotation on the field. When I was setting up the test project, trying to reproduce the problem, I used the Roo Shell to add the field, and noticed the enum had an annotation on it. This missing annotation was causing the NullPointerException.

                  I confirmed by removing the @Enumerated from the sample project, then did a 'controller all --package ~.web'. The sample project then threw the same exception.

                  I would be nice if the error message in the Roo Shell would have given a little more information, perhaps just saying what field it was processing when it blew up? Since it was my attempt to add DB-based security that triggered the Controller update, and the error message didn't really give me many clues, I blindly assumed it was related to the security changes.

                  Comment


                  • #10
                    Ok, good to know what caused your issue. Can you please open a Jira improvement ticket so we can follow this up? Please attach a simple project + steps to reproduce.

                    Comment


                    • #11
                      Done. JIRA Story is 2476.

                      Comment

                      Working...
                      X