glassfish
  1. glassfish
  2. GLASSFISH-14001

Creating Profiler in any config except server-config results in error

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_b41 , not determined
    • Component/s: admin_gui
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      I have filed a similar bug, ie any changes to JVM will go to server-config.

      To reproduce the problem:

      • copy server-config to 'TEST-config'
      • go to TEST-config -> JVM -> Profiler page
      • enter 'ABC' as the profiler name. click SAVE

      You will see 'an error has occurred' without saying any reason.

      Look at server.log, you will see there is an NPE:

      [#|2010-10-14T22:34:40.817-
      0700|SEVERE|glassfish3.1|org.glassfish.admingui|_ThreadID=105;_ThreadName=admin-thread-pool-
      4848(7);|Exception Occurred:
      java.lang.NullPointerException
      at
      org.glassfish.admingui.common.handlers.InstanceHandler.getJvmOptions(InstanceHandler.java:134)
      at
      org.glassfish.admingui.common.handlers.InstanceHandler.deleteJvmOptions(InstanceHandler.java:175)
      at
      org.glassfish.admingui.common.handlers.InstanceHandler.saveJvmOptionValues(InstanceHandler.java:1
      50)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      1. JvmSettingsTest.java
        9 kB
        Anissa Lam
      2. server.log
        27 kB
        shaline
      3. server.log.ins1
        18 kB
        shaline

        Activity

        Hide
        ludo added a comment -

        I though we moved all generic delete and update to CLI commands to make sure replication is working...
        I guess we are missing one?
        Yes, moving to the real cli command works.
        On REST side we would need to map it to the DELETE under this resource...

        Show
        ludo added a comment - I though we moved all generic delete and update to CLI commands to make sure replication is working... I guess we are missing one? Yes, moving to the real cli command works. On REST side we would need to map it to the DELETE under this resource...
        Hide
        ludo added a comment -

        Hum...delete-profiler is mapping in the config bean directly so we use this mapping....
        But it is defined in the javaconfig bean:

        @Configured
        @RestRedirects(

        { @RestRedirect(opType = RestRedirect.OpType.POST, commandName = "create-profiler"), @RestRedirect(opType = RestRedirect.OpType.DELETE, commandName = "delete-profiler") }

        )
        public interface JavaConfig extends ConfigBeanProxy, Injectable, PropertyBag, JvmOptionBag {

        Wrong place?

        Show
        ludo added a comment - Hum...delete-profiler is mapping in the config bean directly so we use this mapping.... But it is defined in the javaconfig bean: @Configured @RestRedirects( { @RestRedirect(opType = RestRedirect.OpType.POST, commandName = "create-profiler"), @RestRedirect(opType = RestRedirect.OpType.DELETE, commandName = "delete-profiler") } ) public interface JavaConfig extends ConfigBeanProxy, Injectable, PropertyBag, JvmOptionBag { Wrong place?
        Hide
        Anissa Lam added a comment -

        Here is the svn diff. I have tested different scenario:

        • das
        • stopped instance
        • running instance
          create/delete/edit jvm profiler all works correctly.

        There is a call of gf.getEntityAttrs() which is suppose to get the default value of the profiler attributes. But it was using the wrong endpoint, and actually there is no way to get the default attribute of profiler if the profiler doesn't exist. So, i remove that and just hardcoded 'enabled' to true. This is the only attribute that has default anyway.

        Index: src/main/resources/javaConfig/jvmProfiler_1.inc
        ===================================================================
        — src/main/resources/javaConfig/jvmProfiler_1.inc (revision 44781)
        +++ src/main/resources/javaConfig/jvmProfiler_1.inc (working copy)
        @@ -52,18 +52,17 @@
        <!beforeCreate
        setSessionAttribute(key="javaConfigTab" value="profiler");
        getRequestValue(key="configName" value=>$page

        {configName}

        default="server-config");
        -

        • setPageSessionAttribute(key="parentUrl", value="# {sessionScope.REST_URL}/configs/config/#{pageSession.configName}");
          +
          + urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}");
          + setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}

          /configs/config/#

          {pageSession.encodedConfigName}

          ");
          setPageSessionAttribute(key="selfUrl", value="#

          {pageSession.parentUrl}/java-config");
          setPageSessionAttribute(key="rest-api" value="true");
          - gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json", valueMap="#{pageSession.valueMap}");
          -
          setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/javaConfig/serverInstProfiler.jsf");
          setPageSessionAttribute(key="childType" value="profiler");
          setPageSessionAttribute(key="confirmDeleteMsg" value="$resource{i18nc.msg.JS.confirmDeleteProfiler}");
          setPageSessionAttribute(key="profilerUrl", value="#{pageSession.parentUrl}

          /java-config/profiler");
          setPageSessionAttribute(key="createProfilerUrl", value="#

          {pageSession.parentUrl}/java-config/create-profiler");
          - setPageSessionAttribute(key="deleteProfilerUrl", value="#{pageSession.parentUrl}

          /java-config/profiler");
          + setPageSessionAttribute(key="deleteProfilerUrl", value="#

          {pageSession.parentUrl}

          /java-config/profiler/delete-profiler");
          gf.checkIfEndPointExist(endpoint="#

          {pageSession.profilerUrl}/jvm-options" exists="#{pageSession.edit}");

          if(#{edit}) {
          @@ -71,6 +70,11 @@
          getJvmOptionsValues(endpoint="#{pageSession.profilerUrl}

          /jvm-options.json" result=>$attribute

          {tableList});
          gf.listCombine(list="#{null}" list2="$attribute{tableList}

          ", result="#

          {pageSession.origList}

          ");
          }
          + //there is no way to get the default value of profiler when one doesn't exist. just hard code 'enabled' to true
          + if ("#

          {edit}

          =false")

          Unknown macro: {+ createMap(result="#{pageSession.valueMap}");
          + mapPut(map="#{pageSession.valueMap}" key="enabled" value="true");+ }

          setPageSessionAttribute(key="onlyUseAttrs" value=

          {"name", "target", "classpath", "enabled","nativeLibraryPath"}

          )
          setPageSessionAttribute(key="convertToFalseList" value=

          {"enabled"}

          );
          />

        Show
        Anissa Lam added a comment - Here is the svn diff. I have tested different scenario: das stopped instance running instance create/delete/edit jvm profiler all works correctly. There is a call of gf.getEntityAttrs() which is suppose to get the default value of the profiler attributes. But it was using the wrong endpoint, and actually there is no way to get the default attribute of profiler if the profiler doesn't exist. So, i remove that and just hardcoded 'enabled' to true. This is the only attribute that has default anyway. Index: src/main/resources/javaConfig/jvmProfiler_1.inc =================================================================== — src/main/resources/javaConfig/jvmProfiler_1.inc (revision 44781) +++ src/main/resources/javaConfig/jvmProfiler_1.inc (working copy) @@ -52,18 +52,17 @@ <!beforeCreate setSessionAttribute(key="javaConfigTab" value="profiler"); getRequestValue(key="configName" value=>$page {configName} default="server-config"); - setPageSessionAttribute(key="parentUrl", value="# {sessionScope.REST_URL}/configs/config/#{pageSession.configName}"); + + urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}"); + setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL} /configs/config/# {pageSession.encodedConfigName} "); setPageSessionAttribute(key="selfUrl", value="# {pageSession.parentUrl}/java-config"); setPageSessionAttribute(key="rest-api" value="true"); - gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json", valueMap="#{pageSession.valueMap}"); - setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/javaConfig/serverInstProfiler.jsf"); setPageSessionAttribute(key="childType" value="profiler"); setPageSessionAttribute(key="confirmDeleteMsg" value="$resource{i18nc.msg.JS.confirmDeleteProfiler}"); setPageSessionAttribute(key="profilerUrl", value="#{pageSession.parentUrl} /java-config/profiler"); setPageSessionAttribute(key="createProfilerUrl", value="# {pageSession.parentUrl}/java-config/create-profiler"); - setPageSessionAttribute(key="deleteProfilerUrl", value="#{pageSession.parentUrl} /java-config/profiler"); + setPageSessionAttribute(key="deleteProfilerUrl", value="# {pageSession.parentUrl} /java-config/profiler/delete-profiler"); gf.checkIfEndPointExist(endpoint="# {pageSession.profilerUrl}/jvm-options" exists="#{pageSession.edit}"); if(#{edit}) { @@ -71,6 +70,11 @@ getJvmOptionsValues(endpoint="#{pageSession.profilerUrl} /jvm-options.json" result=>$attribute {tableList}); gf.listCombine(list="#{null}" list2="$attribute{tableList} ", result="# {pageSession.origList} "); } + //there is no way to get the default value of profiler when one doesn't exist. just hard code 'enabled' to true + if ("# {edit} =false") Unknown macro: {+ createMap(result="#{pageSession.valueMap}"); + mapPut(map="#{pageSession.valueMap}" key="enabled" value="true");+ } setPageSessionAttribute(key="onlyUseAttrs" value= {"name", "target", "classpath", "enabled","nativeLibraryPath"} ) setPageSessionAttribute(key="convertToFalseList" value= {"enabled"} ); />
        Hide
        sirajg added a comment -

        Changes look good.

        Show
        sirajg added a comment - Changes look good.
        Hide
        Anissa Lam added a comment -

        Fix checked into both Trunk and 3.1 branch.
        Trunk: rev# 44795
        3.1 branch: rev# 44796

        -------------------------
        Project: glassfish
        Repository: svn
        Revision: 44795
        Author: anilam
        Date: 2011-01-31 16:59:25 UTC
        Link:

        Log Message:
        ------------
        GLASSFISH-14001. Fix JVM Profiler issue with running server. change to use delete-profiler command instead of using generic config bean function.
        Manual test and dev test added.
        Reviewer: Siraj
        Approved by Nazrul

        Revisions:
        ----------
        44795

        Modified Paths:
        ---------------
        trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/JvmSettingsTest.java
        trunk/v3/admingui/common/src/main/resources/javaConfig/jvmProfiler_1.inc
        trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/StandaloneTest.java

        Show
        Anissa Lam added a comment - Fix checked into both Trunk and 3.1 branch. Trunk: rev# 44795 3.1 branch: rev# 44796 ------------------------- Project: glassfish Repository: svn Revision: 44795 Author: anilam Date: 2011-01-31 16:59:25 UTC Link: Log Message: ------------ GLASSFISH-14001 . Fix JVM Profiler issue with running server. change to use delete-profiler command instead of using generic config bean function. Manual test and dev test added. Reviewer: Siraj Approved by Nazrul Revisions: ---------- 44795 Modified Paths: --------------- trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/JvmSettingsTest.java trunk/v3/admingui/common/src/main/resources/javaConfig/jvmProfiler_1.inc trunk/v3/admingui/devtests/src/test/java/org/glassfish/admingui/devtests/StandaloneTest.java

          People

          • Assignee:
            Anissa Lam
            Reporter:
            Anissa Lam
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: