Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3530

x_Roo_JavaBean.aj not being generated when entities and repositories created in alternative package

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.5.RELEASE
    • Fix Version/s: None
    • Component/s: GENERAL OBJECTS
    • Labels:
    • Environment:
      Spring IDE Roo Support 3.6.1.201408250730-RELEASE
      Spring Roo (production release) 1.2.5.RELEASE
      Spring Tool Suite 3.6.1.201408250826-RELEASE-e38

      Windows 7 Professional 64-bit

      Description

      I have created a Spring Roo project using JSF and Primefaces, and have successfully created a basic working web application using the following roo shell commands (Based on the bikeshop example):

      entity jpa --class ~.domain.Entity1 --activeRecord false --equals --testAutomatically
      entity jpa --class ~.domain.Entity2 --activeRecord false --equals --testAutomatically
      entity jpa --class ~.domain.Entity3 --activeRecord false --equals --testAutomatically
      repository jpa --interface ~.domain.Entity1
      repository jpa --interface ~.domain.Entity2
      repository jpa --interface ~.domain.Entity3
      web jsf all --package ~.web

      A few basic fields were added manually to the entities.

      I then wanted to move away from the problem domain and add additional system infrastructure for my application. To highlight this distinction, I wanted to store these entities, repositories and web infrastructure in a package called system. To do this, I entered the following commands at the roo shell.

      entity jpa --class ~.system.domain.SystemMessage --activeRecord false --equals --testAutomatically
      entity jpa --class ~.system.domain.SystemNotification --activeRecord false --equals --testAutomatically
      entity jpa --class ~.system.domain.SystemReminder --activeRecord false --equals --testAutomatically
      repository jpa --interface ~.system.domain.SystemMessageRepository
      repository jpa --interface ~.system.domain.SystemNotificationRepository
      repository jpa --interface ~.system.domain.SystemReminderRepository
      web jsf all --package ~.system.web

      When accessed from a browser, the menu appears with no page output. The errors that appear at the console indicate:

      Aug 29, 2014 9:08:57 PM com.sun.faces.util.Util checkIdUniqueness
      SEVERE: JSF1007: Duplicate component ID menuForm:appUserSubmenu found in view.

      On closer inspection, the menu contains two instances of every submenu, one after the other.

      2nd attempt
      ---------------
      I then threw away the above changes by closing the STS deleting the root folder and getting a new copy of the application files from SVN. This gave me a working system produced from entering the first set of roo shell commands above.

      I then typed in the second set of commands into the roo shell with the exception of the web jsf command. Instead I typed:

      web jsf all --package ~.web

      This is the same command as used in the first set of roo shell commands. This time, the application started and all menu items can be selected correctly except for the SystemMessage options and the SystemNotification options. The SystemReminder options work correctly. The SystemMessage and SystemNotification options generate the following stack trace:

      HTTP Status 500 - javax.el.PropertyNotFoundException: Target Unreachable, identifier 'systemMessageBean' resolved to null

      type Exception report

      message javax.el.PropertyNotFoundException: Target Unreachable, identifier 'systemMessageBean' resolved to null

      description The server encountered an internal error that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'systemMessageBean' resolved to null
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
      org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

      root cause

      javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'systemMessageBean' resolved to null
      javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:95)
      com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      javax.faces.component.UICommand.broadcast(UICommand.java:315)
      javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

      root cause

      javax.el.PropertyNotFoundException: Target Unreachable, identifier 'systemMessageBean' resolved to null
      org.apache.el.parser.AstValue.getTarget(AstValue.java:98)
      org.apache.el.parser.AstValue.invoke(AstValue.java:259)
      org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
      javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      javax.faces.component.UICommand.broadcast(UICommand.java:315)
      javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

      On closer inspection, the SystemReminderBean_Roo_ManagedBean.aj file has been generated but the equivalent files for SystemMessage and SystemNotification have not. The sources for the 3 entities are as follows:

      @RooJavaBean
      @RooToString
      @RooJpaEntity
      @RooEquals
      public class SystemMessage {
      }

      @RooJavaBean
      @RooToString
      @RooJpaEntity
      @RooEquals
      public class SystemNotification {
      }

      @RooJavaBean
      @RooToString
      @RooJpaEntity
      @RooEquals
      public class SystemReminder {
      }

      I didn't bother creating any fields in them this time. I have performed this test twice now and both times it is the last entity in the System package that works (SystemReminder) and not the first 2.

      3rd attempt
      --------------
      I started from a working system again and then entered the following roo shell commands, which are in the opposite order to the previous test:

      entity jpa --class ~.system.domain.SystemReminder --activeRecord false --equals --testAutomatically
      entity jpa --class ~.system.domain.SystemNotification --activeRecord false --equals --testAutomatically
      entity jpa --class ~.system.domain.SystemMessage --activeRecord false --equals --testAutomatically

      repository jpa --interface ~.system.domain.SystemReminderRepository
      repository jpa --interface ~.system.domain.SystemNotificationRepository
      repository jpa --interface ~.system.domain.SystemMessageRepository

      web jsf all --package ~.web

      This time the SystemMessage menus worked (The last entity created) and the other two didn't. As expected, a SystemMessageBean_Roo_ManagedBean.aj was created but no equivalents were created for the first two entities in the system package.

        Attachments

          Activity

            People

            • Assignee:
              eruiz Enrique Ruiz (DiSiD)
              Reporter:
              pts814 Paul Scott
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: