stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajkumar Rajaratnam <rajkum...@wso2.com>
Subject Re: Undeploying an application, which is not deployed, throws NPE
Date Mon, 05 Jan 2015 07:51:17 GMT
This is fixed now.

Thanks.

On Mon, Jan 5, 2015 at 12:08 PM, Rajkumar Rajaratnam <rajkumarr@wso2.com>
wrote:

> Thanks Lahiru/Isuru.
>
> I will fix it.
>
> Thanks.
>
> On Mon, Jan 5, 2015 at 11:47 AM, Lahiru Sandaruwan <lahirus@wso2.com>
> wrote:
>
>>
>>
>> On Mon, Jan 5, 2015 at 11:31 AM, Rajkumar Rajaratnam <rajkumarr@wso2.com>
>> wrote:
>>
>>> Yeah.
>>>
>>> Can anyone recall the reason behind this logic (highlighted in red
>>> color)? We can put a null check there. But I want to understand what we are
>>> doing here. Why we need to create the application context in
>>> undeployApplication API?
>>>
>>
>> It seems logic is, that updating application to "created" status since
>> the application is not deployed anymore.
>>
>> Solution should be adding a null check and stop the flow if application
>> is null as you suggested.
>>
>> Thanks.
>>
>>>
>>> Thanks.
>>>
>>> On Mon, Jan 5, 2015 at 11:20 AM, Udara Liyanage <udara@wso2.com> wrote:
>>>
>>>> HI Raj,
>>>>
>>>> I too experienced this while doing alpha testing.  There is a jira I
>>>> reported too.
>>>>
>>>> On Mon, Jan 5, 2015 at 9:46 AM, Rajkumar Rajaratnam <rajkumarr@wso2.com
>>>> > wrote:
>>>>
>>>>> This is the undeployApplication API.
>>>>>
>>>>> Why we are doing something in red here?
>>>>>
>>>>> As application context is not there, it is throwing NPE.
>>>>>
>>>>> @Override
>>>>> public void undeployApplication(String applicationId) {
>>>>>     try {
>>>>>         if (log.isInfoEnabled()) {
>>>>>             log.info("Starting to undeploy application:
>>>>> [application-id] " + applicationId);
>>>>>         }
>>>>>
>>>>>         ApplicationBuilder.handleApplicationUndeployed(applicationId);
>>>>>
>>>>>         ApplicationContext applicationContext =
>>>>> AutoscalerContext.getInstance().getApplicationContext(applicationId);
>>>>>
>>>>> applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
>>>>>
>>>>> AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
>>>>>
>>>>>         DeploymentPolicy deploymentPolicy =
>>>>> PolicyManager.getInstance().getDeploymentPolicy(applicationId);
>>>>>
>>>>> PolicyManager.getInstance().removeDeploymentPolicy(deploymentPolicy);
>>>>>
>>>>>         if (log.isInfoEnabled()) {
>>>>>             log.info("Application undeployed successfully:
>>>>> [application-id] " + applicationId);
>>>>>         }
>>>>>     } catch (Exception e) {
>>>>>         String message = "Could not undeploy application:
>>>>> [application-id] " + applicationId;
>>>>>         log.error(message, e);
>>>>>         throw new RuntimeException(message, e);
>>>>>     }
>>>>> }
>>>>>
>>>>> Thanks.
>>>>>
>>>>> On Mon, Jan 5, 2015 at 9:45 AM, Rajkumar Rajaratnam <
>>>>> rajkumarr@wso2.com> wrote:
>>>>>
>>>>>> Hi Devs,
>>>>>>
>>>>>> $Subject on master branch.
>>>>>>
>>>>>>
>>>>>> [2015-01-05 09:28:05,813]  INFO
>>>>>> {org.apache.stratos.autoscaler.api.AutoScalerServiceImpl} -  Starting
to
>>>>>> undeploy application: [application-id] single-cartridge-app
>>>>>> [2015-01-05 09:28:05,813]  WARN
>>>>>> {org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder}
-
>>>>>> Application does not exist: [application-id] single-cartridge-app
>>>>>> [2015-01-05 09:28:05,815] ERROR
>>>>>> {org.apache.stratos.autoscaler.api.AutoScalerServiceImpl} -  Could
not
>>>>>> undeploy application: [application-id] single-cartridge-app
>>>>>> java.lang.NullPointerException
>>>>>>     at
>>>>>> org.apache.stratos.autoscaler.api.AutoScalerServiceImpl.undeployApplication(AutoScalerServiceImpl.java:297)
>>>>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>     at
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>     at
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>     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$Worker.runTask(ThreadPoolExecutor.java:895)
>>>>>>     at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>>>>>     at java.lang.Thread.run(Thread.java:662)
>>>>>> [2015-01-05 09:28:05,816] ERROR
>>>>>> {org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver} -  Could
not
>>>>>> undeploy application: [application-id] single-cartridge-app
>>>>>> java.lang.RuntimeException: Could not undeploy application:
>>>>>> [application-id] single-cartridge-app
>>>>>>     at
>>>>>> org.apache.stratos.autoscaler.api.AutoScalerServiceImpl.undeployApplication(AutoScalerServiceImpl.java:309)
>>>>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>     at
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>     at
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>     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$Worker.runTask(ThreadPoolExecutor.java:895)
>>>>>>     at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>>>>>     at java.lang.Thread.run(Thread.java:662)
>>>>>> Caused by: java.lang.NullPointerException
>>>>>>     at
>>>>>> org.apache.stratos.autoscaler.api.AutoScalerServiceImpl.undeployApplication(AutoScalerServiceImpl.java:297)
>>>>>>     ... 44 more
>>>>>> [2015-01-05 09:28:05,817] ERROR
>>>>>> {org.apache.axis2.receivers.AbstractMessageReceiver} -
>>>>>> org.apache.axis2.AxisFault: Could not undeploy application:
>>>>>> [application-id] single-cartridge-app
>>>>>>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> --
>>>>>> Rajkumar Rajaratnam
>>>>>> Committer & PMC Member, Apache Stratos
>>>>>> Software Engineer, WSO2
>>>>>>
>>>>>> Mobile : +94777568639
>>>>>> Blog : rajkumarr.com
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Rajkumar Rajaratnam
>>>>> Committer & PMC Member, Apache Stratos
>>>>> Software Engineer, WSO2
>>>>>
>>>>> Mobile : +94777568639
>>>>> Blog : rajkumarr.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Udara Liyanage
>>>> Software Engineer
>>>> WSO2, Inc.: http://wso2.com
>>>> lean. enterprise. middleware
>>>>
>>>> web: http://udaraliyanage.wordpress.com
>>>> phone: +94 71 443 6897
>>>>
>>>
>>>
>>>
>>> --
>>> Rajkumar Rajaratnam
>>> Committer & PMC Member, Apache Stratos
>>> Software Engineer, WSO2
>>>
>>> Mobile : +94777568639
>>> Blog : rajkumarr.com
>>>
>>
>>
>>
>> --
>> --
>> Lahiru Sandaruwan
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>> lean.enterprise.middleware
>>
>> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>
>
>
> --
> Rajkumar Rajaratnam
> Committer & PMC Member, Apache Stratos
> Software Engineer, WSO2
>
> Mobile : +94777568639
> Blog : rajkumarr.com
>



-- 
Rajkumar Rajaratnam
Committer & PMC Member, Apache Stratos
Software Engineer, WSO2

Mobile : +94777568639
Blog : rajkumarr.com

Mime
View raw message