Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b66
    • Fix Version/s: None
    • Component/s: rest-interface
    • Labels:
      None

      Description

      Occasionally I am seeing that between different runs of glassfish, a rest resource like http://localhost:4848/management/domain/servers/server stops working. It took me considerable time to debug and here is my finding:
      nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/resources/TemplateListOfResource.java has some code which determines what's the POST method for a resource. It goes through all methods of a config bean and finds out the command name from @Create. It is written like this:
      for (Method m : cbp.getMethods()) {
      ConfigModel.Property pp = parent.model.toProperty(m);
      if ((pp != null) && (pp.xmlName.equals(tagName)))

      { create = m.getAnnotation(Create.class); break; }

      }

      The problem is this loop can break when it should not. I see for Servers config bean, it stops iterating the moment it sees a method called getServer(). Now, there are two getServer methods in Servers class. One is annotated with @Create and the other one is not. So, depending on the order of Class.getMethods(), this method sometimes returns null. Tom corretcly pointed to me that in JDK7, Class.getMethods returns the methods in some random order that can very from run to run of the JVM even if the code hasn't changed.

        Issue Links

          Activity

          Hide
          Sanjeeb Sahoo added a comment -

          I am pretty sure there are more than one place in ReST admin code, we have similar issue. So, while fixing this issue, please look for other such occurrences and fix them as well.

          Show
          Sanjeeb Sahoo added a comment - I am pretty sure there are more than one place in ReST admin code, we have similar issue. So, while fixing this issue, please look for other such occurrences and fix them as well.
          Hide
          Jason Lee added a comment -

          I committed what I hope is the fix for this. Since it's random, it's hard to verify. Please keep an eye on this where you're seeing it to see if it happens again. If I don't hear of any additional problems after a few days, I'll go ahead and close this.

          Show
          Jason Lee added a comment - I committed what I hope is the fix for this. Since it's random, it's hard to verify. Please keep an eye on this where you're seeing it to see if it happens again. If I don't hear of any additional problems after a few days, I'll go ahead and close this.
          Hide
          Jason Lee added a comment -

          No further issues have been reported. Closing as fixed.

          Show
          Jason Lee added a comment - No further issues have been reported. Closing as fixed.

            People

            • Assignee:
              Jason Lee
              Reporter:
              Sanjeeb Sahoo
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: