Before an application is deployed, our “wrapper code” tries to remove any cartridge group within the application which causes the following exception:

 

TID: [0] [STRATOS] [2015-06-25 09:55:30,791] DEBUG {org.apache.stratos.autoscaler.registry.RegistryManager} -  org.apache.stratos.autoscaler.pojo.ServiceGroup@6aa447a0

TID: [0] [STRATOS] [2015-06-25 09:55:30,810] ERROR {org.apache.stratos.rest.endpoint.api.StratosApiV41Utils} -  Cannot remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in another cartridge group or an application

TID: [0] [STRATOS] [2015-06-25 09:55:30,811] ERROR {org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper} -  Cannot remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in another cartridge group or an application

org.apache.stratos.rest.endpoint.exception.RestAPIException: Cannot remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in another cartridge group or an application

               at org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.removeServiceGroup(StratosApiV41Utils.java:1252)

               at org.apache.stratos.rest.endpoint.api.StratosApiV41.removeServiceGroup(StratosApiV41.java:587)

               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

               at java.lang.reflect.Method.invoke(Method.java:606)

               at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

               at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

               at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:194)

               at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100)

               at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)

               at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)

               at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)

               at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

               at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)

               at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)

               at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)

               at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)

               at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:159)

               at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)

               at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doDelete(AbstractHTTPServlet.java:217)

               at javax.servlet.http.HttpServlet.service(HttpServlet.java:761)

               at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)

               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

               at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)

 

From: Imesh Gunaratne [mailto:imesh@apache.org]
Sent: Thursday, June 25, 2015 4:29 AM
To: dev
Cc: Reka Thirunavukkarasu; Ryan Du Plessis (rdupless); Shaheedur Haque (shahhaqu)
Subject: Re: Testing Stratos 4.1 - application removal still fails in certain cases

 

Hi Martin,

 

On Thu, Jun 25, 2015 at 4:38 PM, Martin Eppel (meppel) <meppel@cisco.com> wrote:

 

What happens if I want to restart / redeploy the application -  currently, when I try to re-deploy the application it throws an exception that the cartridge group is still referenced by another application ? 

 

Will you be able to send the log file related to this error?

 

On Thu, Jun 25, 2015 at 4:38 PM, Martin Eppel (meppel) <meppel@cisco.com> wrote:

 

What happens if I want to restart / redeploy the application -  currently, when I try to re-deploy the application it throws an exception that the cartridge group is still referenced by another application ? Even if the group would not exist, wouldn’t stratos throw an exception that the application already exists ? What is the proper way to restart / redeploy an application ?

 

Thanks

 

Martin

 

Adding Shaheed

 

From: Reka Thirunavukkarasu [mailto:reka@wso2.com]
Sent: Thursday, June 25, 2015 3:45 AM
To: Martin Eppel (meppel)
Cc: dev@stratos.apache.org; Ryan Du Plessis (rdupless)
Subject: Re: Testing Stratos 4.1 - application removal still fails in certain cases

 

Hi Martin,

 

On Thu, Jun 25, 2015 at 3:58 PM, Martin Eppel (meppel) <meppel@cisco.com> wrote:

Hi Reka,

 

I pulled the latest code today and  tested the following application [1a., 1b.] for removal and, after all the instances were terminated the application still shows in the “Created” state  [1c.]  and maintains a reference to the cartridge groups, my expectation would be that it had been removed completely !

 

This is the expected behaviour. This is the status of the application definition. I just verified it in the CLI. After the successful undeployment, it shows as below for me.

Applications found:
+----------------+------------+---------+
| Application ID | Alias      | Status  |
+----------------+------------+---------+
| g-sc-G12-1     | g-sc-G12-1 | Created |
+----------------+------------+---------+

In order to check the runtime, you will have to invoke below command:

stratos> describe-application-runtime g-sc-G12-1
Application not found: g-sc-G12-1
stratos>

However there seems to be a small issue with this message as it says applicaiton not found instead of application runtime. We will fix this ASAP in the cli.

If you invoke rest endpoint, you will get the following message:

curl -X GET -H "Content-Type: application/json"  -k -v -u admin:admin https://127.0.0.1:9443/api/applications/g-sc-G12-1/runtime

{"status":"error","message":"Application runtime not found"}

Please let me know if you still have any issues..

Thanks,

Reka

 

 

The logs actually state that the application was successfully un-deployed !?  Logs are attached as usual, application json, group json are below

 

TID: [0] [STRATOS] [2015-06-25 09:48:23,302]  INFO {org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder} -  Application un-deployed successfully: [application-id] sub-G1-G2-G3-1

 

Please note that the screenshot was taken after the request to remove the application was done.

 

 

[1a.]

 

[1b]

 

Cartridge-group:

 

{"name": "sub-G1-G2-G3-1", "dependencies": {"terminationBehaviour": "terminate-none", "startupOrders": []}, "cartridges": [], "groups": [{"name": "multiple-groups-no-startup-G1-1", "dependencies": {"terminationBehaviour": "terminate-none", "startupOrders": []}, "cartridges": ["c1", "c2"], "groups": []}, {"name": "multiple-groups-no-startup-G2-1", "dependencies": {"terminationBehaviour": "terminate-none", "startupOrders": []}, "cartridges": ["c3", "c4"], "groups": []}]}

 

 

Application:

 

{"alias": "sub-G1-G2-G3-1", "applicationId": "sub-G1-G2-G3-1", "components": {"cartridges": [], "groups": [{"name": "sub-G1-G2-G3-1", "groupMaxInstances": 1, "groupMinInstances": 1, "alias": "sub-G1-G2-G3-1-x0x", "cartridges": [], "groups": [{"name": "multiple-groups-no-startup-G1-1", "groupMaxInstances": 1, "groupMinInstances": 1, "alias": "multiple-groups-no-startup-G1-1-0x0", "cartridges": [{"cartridgeMin": 1, "cartridgeMax": 1, "type": "c1", "subscribableInfo": {"alias": "c1-1x0", "deploymentPolicy": "static-1", "artifactRepository": {"repoUsername": "user", "repoUrl": "http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}, {"cartridgeMin": 1, "cartridgeMax": 1, "type": "c2", "subscribableInfo": {"alias": "c2-1x0", "deploymentPolicy": "static-1", "artifactRepository": {"repoUsername": "user", "repoUrl": "http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}], "groups": []}, {"name": "multiple-groups-no-startup-G2-1", "groupMaxInstances": 1, "groupMinInstances": 1, "alias": "multiple-groups-no-startup-G2-1-0x0", "cartridges": [{"cartridgeMin": 1, "cartridgeMax": 1, "type": "c3", "subscribableInfo": {"alias": "c3-1x1", "deploymentPolicy": "static-1", "artifactRepository": {"repoUsername": "user", "repoUrl": "http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}, {"cartridgeMin": 1, "cartridgeMax": 1, "type": "c4", "subscribableInfo": {"alias": "c4-1x1", "deploymentPolicy": "static-1", "artifactRepository": {"repoUsername": "user", "repoUrl": "http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}], "groups": []}]}]}}

 

 

[1c.]

 

stratos> list-applications

Applications found:

+----------------+----------------+---------+

| Application ID | Alias          | Status  |

+----------------+----------------+---------+

| sub-G1-G2-G3-1 | sub-G1-G2-G3-1 | Created |

+----------------+----------------+---------+

stratos>

 




--

Reka Thirunavukkarasu
Senior Software Engineer,
WSO2, Inc.:http://wso2.com,

Mobile: +94776442007

 



 

--

Imesh Gunaratne

 

Senior Technical Lead, WSO2

Committer & PMC Member, Apache Stratos