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

  • Controller Issues

    Hi,
    Using the Spring Roo shell, earlier I created three entities and performed the controller all function. However, I then implemented the string converters into the java controllers and deleted them out of the aspectj controllers, because Roo's aspect j files appended unnecessary information to each reference field. After I did this, the Roo shell displays this message every time I open it:
    Managed SRC_MAIN_JAVA\com\comcast\neto\engineering_analysi s\domain\Project_Roo_Entity.aj
    Undo manage SRC_MAIN_JAVA\com\comcast\neto\engineering_analysi s\domain\Project_Roo_Entity.aj
    Method 'getProjectConverter' already defined in target type 'com.comcast.neto.engineering_analysis.ResourceCon troller' (ITD target 'com.comcast.neto.engineering_analysis.ResourceCon troller_Roo_Controller').
    This is an issue, because now I am unable to edit my entities via the Roo shell or manually. Does anyone know how to resolve this issue?

    Thanks,
    MGilbe200

  • #2
    Using the Spring Roo shell, earlier I created three entities and performed the controller all function. However, I then implemented the string converters into the java controllers and deleted them out of the aspectj controllers, because Roo's aspect j files appended unnecessary information to each reference field.
    You shouldn't need to "delete them out of the aspectj", if you copy the converter into the java file and remove the ControllerName and save the file, the next time you run roo or if roo is running, it will remove the converter from the aspectj file for you. One thing I have noticed if I have a typo or something, roo let's me know by not removing it from the aspectj.

    Example:
    ProjectController_Roo_Controller.aj contains this:
    Code:
    Converter<Project,String> ProjectController.getProjectConverter()
      return new Converter<Project, String>() {
        public String convert(Project project) {
         return new StringBuilder().append(project.getName().toString();
        }
      };
    }
    Copied to ResourceController.java:
    Code:
    Converter<Project,String> getProjectConverter()
      return new Converter<Project, String>() {
        public String convert(Project project) {
         return new StringBuilder().append(project.getName().toString();
        }
      };
    }
    Save ProjectController.java. If roo is running, the you should get Managed Project_Controller_Roo_Controller.aj

    When you open up Project_Controll_Roo_Controller.aj the getProjectConverter has been removed, since you declared it in the java file.

    One thing I have noticed if you forget to change ProjectController.getProjectConverter to getProjectConverter then roo doesn't manage anything, and continues to use the original getProjectConverter defined the int .aj

    Another thing I have noticed is that if you have something in the code (usually typos) that roo doesn't understand but is interested in, it causes the Manage/Undo. Once you fix the typo, roo fixes everything and the Undo's go away.

    In some cases, just trying to compile the code, will let you know where the typo is.

    Just started using Roo, so if this information isn't totally correct I apologize, just wanted to share my experience.
    Last edited by btlife; Sep 12th, 2010, 10:23 AM. Reason: Fixed typo of typo lol

    Comment


    • #3
      Followed Your Advice

      Hi again,

      After I followed your advice, the roo shell gave me this response:
      Managed SRC_MAIN_JAVA\com\corp\app\domain\Project_Roo_Enti ty.aj
      Managed SRC_MAIN_JAVA\com\corp\app\ResourceController_Roo_ Controller.aj
      Managed SRC_MAIN_WEBAPP\WEB-INF\views\resources\list.jspx
      Managed SRC_MAIN_WEBAPP\WEB-INF\views\resources\create.jspx
      Managed SRC_MAIN_JAVA\com\corp\app\ProjectController_Roo_C ontroller.aj
      Managed SRC_MAIN_WEBAPP\WEB-INF\views\projects\list.jspx
      Undo manage SRC_MAIN_WEBAPP\WEB-INF\views\projects\list.jspx
      Undo manage SRC_MAIN_JAVA\com\corp\app\ProjectController_Roo_C ontroller.aj
      Undo manage SRC_MAIN_WEBAPP\WEB-INF\views\resources\create.jspx
      Undo manage SRC_MAIN_WEBAPP\WEB-INF\views\resources\list.jspx
      Undo manage SRC_MAIN_JAVA\com\corp\app\ResourceController_Roo_ Controller.aj
      Undo manage SRC_MAIN_JAVA\com\corp\app\domain\Project_Roo_Enti ty.aj
      Value required. This is a problem, because when you run the project from the command line the problems are similar to before. Do you have any other suggestions?

      Thanks again,
      MGilbe200

      P.S. I am using Spring Version 3.0.2.

      Comment


      • #4
        Not really sure, without seeing your code. But I can list a couple things that I have come across.

        1. While cutting and pasting, I moved the converter from the controller file and pasted it in the entity file by mistake.

        Example: Cut getProjectConverter out of ProjectController_Roo_Controller.aj, and pasted it in Project.java instead of ProjectController.java. This messed things up, don't have the exact error it, but can try and reproduce it if you want.

        2. Didn't remove the class name from the convert after moving it.

        Example: Cut ProjectController.getProjectConverter out of ProjectController_Roo_controller.aj and pasted it unmodified into ProjectController.java.

        It looks like there might be a different issue, something not right in your Project.java file.

        Whenever I move the converter from the aj to the java, it doesn't update any views. So what it might be is there is something wrong with a change you made to your Project entity. Then you made the controller change, since roo can't complete the change to the Project, it is undoing all the changes, which includes the the Controller change? Just a guess though.

        one thing you can try is to have ROO regenerate it's files.
        1. Backup your files (Project.java, Project_Roo_Configurable.aj, Project_Roo_Entity.aj, Project_Roo_JavaBean.aj, Project_Roo_Json.aj)
        2. Remove the ROO files for the entity you want it to regenerate (Project_Roo_Configurable.aj, Project_Roo_Entity.aj, Project_Roo_JavaBean.aj, Project_Roo_Json.aj)
        3. Make a change to Project.java and save it
        4. You should see Roo regenerate all those files, if there is an error maybe it will point it out at this time, or if we're lucky it will fix it for you

        You can try repeating that for the ResourceController (backup, then delete ResourceController_Roo_Controller.aj, make a change to ResourcesController.java and save it)
        See if roo either fixes it or reports what the problem is.
        Last edited by btlife; Sep 15th, 2010, 03:49 AM.

        Comment

        Working...
        X