glassfish
  1. glassfish
  2. GLASSFISH-15848

Cannot add another target to application when primary target deleted

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1_b40
    • Fix Version/s: 3.1_b41
    • Component/s: admin_gui
    • Labels:
      None

      Description

      This is a P3 scenario and thus has not been tested yet. Steps to reproduce:

      1. Create a standalone instance and start it.
      2. Deploy an application to this instance, e.g. clusterjsp.ear
      3. Stop instance and delete it.
      4. Go to Applications page, and click on clusterjsp application. Issue 1: the following error is displayed:

      An error has occurred
      REST Request 'http://localhost:4848/management/domain/servers/server/server/application-ref/clusterjsp' failed with response code '404'.

      5. On the same page select "server" in Virtual Servers box and click Save in an attempt to add server as a target for this application. Issue 2: the following error is displayed:

      An error has occurred
      Could not apply changesNo configuration found for servers.server.server.application-ref.clusterjsp

      Workaround for the above is to undeploy the application and deploy it again, thus I'm ok with excluding this for 3.1 release, but I'll leave it for you to decide.

      1. server.log
        24 kB
        lidiam
      1. error-cannot-add-target.JPG
        69 kB
      2. error-when-target-deleted.JPG
        66 kB

        Activity

        Hide
        Anissa Lam added a comment -

        This is an issue that kind of make sense out of the many ones that has been filed today.
        For a DAS only system, application-ref for the DAS is ALWAYS expected. But for the case where the application is deployed to an instance only, and then the instance is deleted, application-ref doesn't exist for this app.
        Even though i don't think this is a production environment use case, would like to fix this for 3.1, otherwise domain.xml is in a less-than expected state.

        -How bad is its impact? (Severity)
        medium. Cannot edit an application that was 'left over' from deleted instance.

        How often does it happen? (Frequency)
        whenever the app is deployed to some target, and then the system changed to a DAS only system.

        -How much effort is required to fix it? (Cost)
        3 hours.

        -What is the risk of fixing it? (Risk)
        should be low. We are not writing any new code. Just have to call some existing method to add back the application-ref element for DAS when it is a DAS only system.

        -Does a work around for the issue exist? Can the workaround be reasonably employed by the end user?
        yes. user should be able to undeploy this application and redeploy to DAS.

        If the issue is not fixed should the issue and its workaround (if applicable) be described in the Release Notes?
        No.

        How long has the bug existed in the product?
        Probably since we support targets for deployment.

        Do regression tests exist for this issue?
        No. We have problem in adding devtest to the deploy screen, Jason has it in his task list.

        Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
        The usual test they run and the GUI dev test.

        When will a tested fix be ready for integration?
        Ready now, svn diff included here.

        ~/Awork/V3/v3/admingui 775) svn diff common
        Index: common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java
        ===================================================================
        — common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java (revision 44894)
        +++ common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java (working copy)
        @@ -256,6 +256,12 @@
        if (clusters.isEmpty() && standalone.isEmpty()){
        //just return Enabled or not.
        enabled = (String)RestUtil.getAttributesMap(prefix "/servers/server/server/"+ref"/"+appName).get("enabled");
        + //for DAS only system, there should always be application-ref created for DAS. However, for the case where the application is
        + //deploye ONLY to a cluster/instance, and then that instance is deleted. The system becomes 'DAS' only, but then the application-ref
        + //for DAS will not exist. For this case, we just look at the application itself
        + if (enabled == null)

        { + enabled = (String)RestUtil.getAttributesMap(prefix +"/applications/application/" + appName).get("enabled"); + }

        if (useImage)

        { return (Boolean.parseBoolean(enabled))? "/resource/images/enabled.png" : "/resource/images/disabled.png"; }

        else{
        Index: common/src/main/resources/applications/appEdit.layout
        ===================================================================
        — common/src/main/resources/applications/appEdit.layout (revision 44894)
        +++ common/src/main/resources/applications/appEdit.layout (working copy)
        @@ -60,8 +60,14 @@
        setPageSessionAttribute(key="appRefUrl" value="#

        {sessionScope.REST_URL}

        /servers/server/server/application-ref/#

        {pageSession.encodedAppName}

        ");
        gf.onlyDASExist(onlyDAS="#

        {pageSession.onlyDASExist}");
        gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}");
        - gf.getTargetEnableInfo(appName="#{pageSession.appName}" status="#{pageSession.status}")
        if (#{pageSession.onlyDASExist}

        ){
        +
        + gf.checkIfEndPointExist(endpoint="#

        {pageSession.appRefUrl}" exists="#{requestScope.exist}");
        + if (! #{requestScope.exist}){
        + convertListToArray(list={"server"} array="#{requestScope.target}" );
        + gf.changeAppTargets(appName="#{pageSession.appName}" targets="#{requestScope.target}" status="true");
        + setPageSessionAttribute(key="status" value="true");
        + }
        gf.getEntityAttrs(endpoint="#{pageSession.appRefUrl}

        " valueMap="#

        {pageSession.valueMap2}");
        mapPut(map="#{pageSession.valueMap2}

        " key="enabled" value="#

        {pageSession.status}");
        setPageSessionAttribute(key="origState" value="#{pageSession.status}

        ");
        @@ -70,6 +76,7 @@
        }

        if (!#

        {pageSession.onlyDASExist}

        ){
        + gf.getTargetEnableInfo(appName="#

        {pageSession.appName}

        " status="#

        {pageSession.status}

        ")
        setPageSessionAttribute(key="finalShowVS" value="#

        {false}

        ");
        setPageSessionAttribute(key="finalShowAvail" value="#

        {pageSession.showAvailability}

        ");
        }

        Show
        Anissa Lam added a comment - This is an issue that kind of make sense out of the many ones that has been filed today. For a DAS only system, application-ref for the DAS is ALWAYS expected. But for the case where the application is deployed to an instance only, and then the instance is deleted, application-ref doesn't exist for this app. Even though i don't think this is a production environment use case, would like to fix this for 3.1, otherwise domain.xml is in a less-than expected state. -How bad is its impact? (Severity) medium. Cannot edit an application that was 'left over' from deleted instance. How often does it happen? (Frequency) whenever the app is deployed to some target, and then the system changed to a DAS only system. -How much effort is required to fix it? (Cost) 3 hours. -What is the risk of fixing it? (Risk) should be low. We are not writing any new code. Just have to call some existing method to add back the application-ref element for DAS when it is a DAS only system. -Does a work around for the issue exist? Can the workaround be reasonably employed by the end user? yes. user should be able to undeploy this application and redeploy to DAS. If the issue is not fixed should the issue and its workaround (if applicable) be described in the Release Notes? No. How long has the bug existed in the product? Probably since we support targets for deployment. Do regression tests exist for this issue? No. We have problem in adding devtest to the deploy screen, Jason has it in his task list. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? The usual test they run and the GUI dev test. When will a tested fix be ready for integration? Ready now, svn diff included here. ~/Awork/V3/v3/admingui 775) svn diff common Index: common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java =================================================================== — common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java (revision 44894) +++ common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java (working copy) @@ -256,6 +256,12 @@ if (clusters.isEmpty() && standalone.isEmpty()){ //just return Enabled or not. enabled = (String)RestUtil.getAttributesMap(prefix "/servers/server/server/"+ref "/"+appName).get("enabled"); + //for DAS only system, there should always be application-ref created for DAS. However, for the case where the application is + //deploye ONLY to a cluster/instance, and then that instance is deleted. The system becomes 'DAS' only, but then the application-ref + //for DAS will not exist. For this case, we just look at the application itself + if (enabled == null) { + enabled = (String)RestUtil.getAttributesMap(prefix +"/applications/application/" + appName).get("enabled"); + } if (useImage) { return (Boolean.parseBoolean(enabled))? "/resource/images/enabled.png" : "/resource/images/disabled.png"; } else{ Index: common/src/main/resources/applications/appEdit.layout =================================================================== — common/src/main/resources/applications/appEdit.layout (revision 44894) +++ common/src/main/resources/applications/appEdit.layout (working copy) @@ -60,8 +60,14 @@ setPageSessionAttribute(key="appRefUrl" value="# {sessionScope.REST_URL} /servers/server/server/application-ref/# {pageSession.encodedAppName} "); gf.onlyDASExist(onlyDAS="# {pageSession.onlyDASExist}"); gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}"); - gf.getTargetEnableInfo(appName="#{pageSession.appName}" status="#{pageSession.status}") if (#{pageSession.onlyDASExist} ){ + + gf.checkIfEndPointExist(endpoint="# {pageSession.appRefUrl}" exists="#{requestScope.exist}"); + if (! #{requestScope.exist}){ + convertListToArray(list={"server"} array="#{requestScope.target}" ); + gf.changeAppTargets(appName="#{pageSession.appName}" targets="#{requestScope.target}" status="true"); + setPageSessionAttribute(key="status" value="true"); + } gf.getEntityAttrs(endpoint="#{pageSession.appRefUrl} " valueMap="# {pageSession.valueMap2}"); mapPut(map="#{pageSession.valueMap2} " key="enabled" value="# {pageSession.status}"); setPageSessionAttribute(key="origState" value="#{pageSession.status} "); @@ -70,6 +76,7 @@ } if (!# {pageSession.onlyDASExist} ){ + gf.getTargetEnableInfo(appName="# {pageSession.appName} " status="# {pageSession.status} ") setPageSessionAttribute(key="finalShowVS" value="# {false} "); setPageSessionAttribute(key="finalShowAvail" value="# {pageSession.showAvailability} "); }
        Hide
        sirajg added a comment -

        Changes look fine.

        Show
        sirajg added a comment - Changes look fine.
        Hide
        Chris Kasso added a comment -

        Approved for RC2.

        Show
        Chris Kasso added a comment - Approved for RC2.
        Hide
        Anissa Lam added a comment -

        Fix checked into both trunk & 3.1 branch.
        trunk: rev# 44920
        3.1 branch: rev# 44921

        ==============

        Project: glassfish
        Repository: svn
        Revision: 44920
        Author: anilam
        Date: 2011-02-05 00:33:22 UTC
        Link:

        Log Message:
        ------------
        GLASSFISH-15848. Add application-ref to "server" for any application that doesn't have this ref when the system is a DAS only system.

        Reviewed by Siraj
        Approved by Chris

        Revisions:
        ----------
        44920

        Modified Paths:
        ---------------
        trunk/v3/admingui/common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java
        trunk/v3/admingui/common/src/main/resources/applications/appEdit.layout

        Show
        Anissa Lam added a comment - Fix checked into both trunk & 3.1 branch. trunk: rev# 44920 3.1 branch: rev# 44921 ============== Project: glassfish Repository: svn Revision: 44920 Author: anilam Date: 2011-02-05 00:33:22 UTC Link: Log Message: ------------ GLASSFISH-15848 . Add application-ref to "server" for any application that doesn't have this ref when the system is a DAS only system. Reviewed by Siraj Approved by Chris Revisions: ---------- 44920 Modified Paths: --------------- trunk/v3/admingui/common/src/main/java/org/glassfish/admingui/common/util/DeployUtil.java trunk/v3/admingui/common/src/main/resources/applications/appEdit.layout
        Hide
        lidiam added a comment -

        Verified in promoted build b43.

        Show
        lidiam added a comment - Verified in promoted build b43.

          People

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

            Dates

            • Due:
              Created:
              Updated:
              Resolved: