Hi,

I created an application and deployed with an deployment policy. Then I
undeployed and deleted the application

curl -X DELETE -H "Content-Type: application/json"
-d@'json/dep_single_group.json'
-k -v -u admin:admin
https://54.151.228.132:9443/api/applications/app_cartridge_v1/undeploy

curl -X DELETE -H "Content-Type: application/json"
-d@'json/dep_single_group.json'
-k -v -u admin:admin
https://54.151.228.132:9443/api/applications/app_cartridge_v1/

Then I created the same application again and tried deploying with the same
deployment policy as I did earlier. Then I got the exception saying
deployment policy is not valid since it alread exist.

TID: [0] [STRATOS] [2014-12-19 04:41:27,109]  WARN
{org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder} -
 Application already exists: [application-id] app_cartridge_v1
TID: [0] [STRATOS] [2014-12-19 04:41:27,134] ERROR
{org.apache.stratos.autoscaler.pojo.policy.PolicyManager} -  Specified
deployment policy [app_cartridge_v1] already exists
TID: [0] [STRATOS] [2014-12-19 04:41:27,135] ERROR
{org.apache.stratos.autoscaler.api.AutoScalerServiceImpl} -  Deployment
policy is not valid: [application-id] app_cartridge_v1
org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException:
Specified deployment policy [app_cartridge_v1] already exists
at
org.apache.stratos.autoscaler.pojo.policy.PolicyManager.addDeploymentPolicyToInformationModel(PolicyManager.java:176)
at
org.apache.stratos.autoscaler.pojo.policy.PolicyManager.addDeploymentPolicy(PolicyManager.java:95)
at
org.apache.stratos.autoscaler.api.AutoScalerServiceImpl.deployApplication(AutoScalerServiceImpl.java:207)

On Fri, Dec 19, 2014 at 9:08 AM, Udara Liyanage <ud...@wso2.com> wrote:
>
> Hi Imesh,
>
> I used the endpoint you have mentioned.
> I have put the commands I have used and log correspond to the command.
>
> On Fri, Dec 19, 2014 at 8:23 AM, Reka Thirunavukkarasu <r...@wso2.com>
> wrote:
>>
>> Yah..I used this undeploy post to remove all the runtime of the
>> application. Whatever we created using deploy will be removed using this
>> POST undeploy command.
>>
>> Thanks,
>> Reka
>>
>> On Thu, Dec 18, 2014 at 11:57 PM, Imesh Gunaratne <im...@apache.org>
>> wrote:
>>>
>>> Hi Udara,
>>>
>>> We have introduced the following API method to undeploy an application
>>> [1]:
>>> POST /applications/{applicationId}/undeploy
>>>
>>> Reka: Did you made the above modifcation to undeploy an application and
>>> then delete it if we receive a DELETE request for a running application?
>>>
>>> [1]
>>> https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+Stratos+API+Reference
>>>
>>> Thanks
>>>
>>> On Thu, Dec 18, 2014 at 11:22 PM, Udara Liyanage <ud...@wso2.com> wrote:
>>>>
>>>> Hi Reka,
>>>>
>>>> Thank I will continue testing tomorrow.
>>>>
>>>>
>>>>
>>>> Touched, not typed. Erroneous words are a feature, not a typo.
>>>> On Dec 18, 2014 11:16 PM, "Reka Thirunavukkarasu" <r...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi Udara,
>>>>>
>>>>> I have fixed the flow in ff9379f66cd5c66dfa3bcba42df4c949407f2883. With
>>>>> the same undeploy application command, application runtime will get 
>>>>> removed
>>>>> after wiping out the members of the clusters. Now i could undeploy
>>>>> the application and deploy the same again without any issue.
>>>>>
>>>>> Thanks,
>>>>> Reka
>>>>>
>>>>> On Thu, Dec 18, 2014 at 7:36 PM, Reka Thirunavukkarasu <r...@wso2.com>
>>>>> wrote:
>>>>>>
>>>>>> It seems that we are not removing the runtime and trying to remove
>>>>>> the policy/persisted application. Since we have changed the application
>>>>>> deployment flow, the earlier application undeployment is no longer 
>>>>>> working.
>>>>>> We will have to fix this...
>>>>>>
>>>>>> Thanks,
>>>>>> Reka
>>>>>>
>>>>>> On Thu, Dec 18, 2014 at 7:30 PM, Udara Liyanage <ud...@wso2.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Imesh,
>>>>>>>
>>>>>>> I deployed application and deployment policy. Instances got started
>>>>>>> up successfully. Now I want to terminate the instances.
>>>>>>>
>>>>>>> I tried undeploying as below.
>>>>>>> *curl -X DELETE -H "Content-Type: application/json"
>>>>>>> -d@'json/dep_single_group.json' -k -v -u admin:admin
>>>>>>> https://54.151.228.132:9443/api/applications/app_cartridge_v1/undeploy
>>>>>>> <https://54.151.228.132:9443/api/applications/app_cartridge_v1/undeploy>*
>>>>>>>
>>>>>>> It resulted in below warning.
>>>>>>>
>>>>>>> TID: [0] [STRATOS] [2014-12-18 13:43:48,324]  WARN
>>>>>>> {org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder} -
>>>>>>>  Application has been found in the ApplicationsTopology: 
>>>>>>> [application-id]
>>>>>>> app_cartridge_v1, Please unDeploy the Application Policy before deleting
>>>>>>> the Application definition.
>>>>>>>
>>>>>>> Then I tried  undeploying application which completed successfully.
>>>>>>> *curl -X DELETE -H "Content-Type: application/json"
>>>>>>> -d@'json/dep_single_group.json' -k -v -u admin:admin
>>>>>>> https://54.151.228.132:9443/api/applications/app_cartridge_v1/
>>>>>>> <https://54.151.228.132:9443/api/applications/app_cartridge_v1/>*
>>>>>>> TID: [0] [STRATOS] [2014-12-18 13:43:36,273]  INFO
>>>>>>> {org.apache.stratos.autoscaler.api.AutoScalerServiceImpl} -  Application
>>>>>>> deleted successfully: [application-id]
>>>>>>>
>>>>>>> Then I tried undeployed again which resulted in following error. I
>>>>>>> think application deletion causes the NPE below.
>>>>>>>
>>>>>>> *curl -X DELETE -H "Content-Type: application/json"
>>>>>>> -d@'json/dep_single_group.json' -k -v -u admin:admin
>>>>>>> https://54.151.228.132:9443/api/applications/app_cartridge_v1/undeploy
>>>>>>> <https://54.151.228.132:9443/api/applications/app_cartridge_v1/undeploy>*
>>>>>>> TID: [0] [STRATOS] [2014-12-18 13:43:48,325] ERROR
>>>>>>> {org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver} -  Exception
>>>>>>> occurred while trying to invoke service method undeployApplication
>>>>>>> java.lang.NullPointerException
>>>>>>> at
>>>>>>> org.apache.stratos.autoscaler.api.AutoScalerServiceImpl.undeployApplication(AutoScalerServiceImpl.java:249)
>>>>>>> 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.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
>>>>>>> at
>>>>>>> org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:66)
>>>>>>> at
>>>>>>> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
>>>>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>>>> at
>>>>>>> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>>>>>>> at
>>>>>>> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
>>>>>>> at
>>>>>>> org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>>>>>>> at
>>>>>>> org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
>>>>>>> at
>>>>>>> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
>>>>>>> at
>>>>>>> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
>>>>>>> at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>>>>>>> at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
>>>>>>> at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>>>>>> 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)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
>>>>>>> at
>>>>>>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
>>>>>>> at
>>>>>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>>>>>>> at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
>>>>>>> at
>>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>>>>>> at
>>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>>>>>>> at
>>>>>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>>>>>>> at
>>>>>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>>>>>>> at
>>>>>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
>>>>>>> at
>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>>>>> at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>>>>> at java.lang.Thread.run(Thread.java:744)
>>>>>>> TID: [0] [STRATOS] [2014-12-18 13:43:48,326] ERROR
>>>>>>> {org.apache.axis2.receivers.AbstractMessageReceiver} -
>>>>>>>  org.apache.axis2.AxisFault
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Udara Liyanage
>>>>>>> Software Engineer
>>>>>>> WSO2, Inc.: http://wso2.com
>>>>>>> lean. enterprise. middleware
>>>>>>>
>>>>>>> web: http://udaraliyanage.wordpress.com
>>>>>>> phone: +94 71 443 6897
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Reka Thirunavukkarasu
>>>>>> Senior Software Engineer,
>>>>>> WSO2, Inc.:http://wso2.com,
>>>>>> Mobile: +94776442007
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Reka Thirunavukkarasu
>>>>> Senior Software Engineer,
>>>>> WSO2, Inc.:http://wso2.com,
>>>>> Mobile: +94776442007
>>>>>
>>>>>
>>>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>> --
>> Reka Thirunavukkarasu
>> Senior Software Engineer,
>> WSO2, Inc.:http://wso2.com,
>> Mobile: +94776442007
>>
>>
>>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Reply via email to