Hi,

Its very fine that have a fix, I will try and give you some feedback if
that works.

Thanks

Clóvis

2016-01-25 4:52 GMT-02:00 Thusitha Thilina Dayaratne <thusit...@wso2.com>:

> Hi,
>
> AFAIU we can easily fix this by adding a null check to webappCC in the
> CarbonWebappClassLoader.getResource method as follows
>
> public Enumeration<URL> getResources(String name) throws IOException {
>     Enumeration[] tmp = new Enumeration[2];
>     if (parent != null && webappCC != null) { // add a null check to webappCC
>
>     .....
>
> WDYT?
>
>
> Thanks
>
> Thusitha
>
>
> On Mon, Jan 25, 2016 at 12:04 PM, Thusitha Thilina Dayaratne <
> thusit...@wso2.com> wrote:
>
>> Hi Clovis,
>>
>> I've checked on the error that you have mentioned.
>> According to the hotswapagent logic 
>> *org.hotswap.agent.plugin.tomcat.TomcatPlugin.init()
>> *method get called during WebappLoader.start lifecycle event. But at the
>> time STARTING event get fired we haven't set the  WebappClassloadingContext
>> to the WebappClassloader. Therefore when it tries to do some checks in
>> order to load the resources it throws the NPE.
>>
>> *org.wso2.carbon.webapp.mgt.loader.CarbonWebappLoader*
>>
>> @Override
>> protected void startInternal() throws LifecycleException {
>>
>> .......
>>
>> super.startInternal();  ----> In this point STARTING even get fired and so 
>> *TomcatPlugin.init * method get called and it try to get the resource. That 
>> called getResources method and since we haven't still set the 
>> webappClassloadingContext it throws a NPE.
>>
>>
>> //Adding the WebappClassloadingContext to the WebappClassloader
>>
>> ((CarbonWebappClassLoader)
>> getClassLoader()).setWebappCC(webappClassloadingContext); // This is the
>> point where we are setting the webappClassloadingContext
>>
>> Thanks
>> Thusitha
>>
>> On Fri, Jan 22, 2016 at 4:54 PM, Clovis Wichoski <clo...@neoinix.com.br>
>> wrote:
>>
>>> Hi Kishanthan,
>>>
>>> The redeploy all of a small system its ok, but for a big one, its a
>>> problem, just a change in one class you must redeploy, loose sessions,
>>> restart the system from scratch, to reach the point of test again, with the
>>> ideas used by HotSwapAgent they act on reloading only that one class
>>> changed, this way speeds the development time, these ideas are well
>>> defended by JRebel tool, that HotSwapAgent tends to be a choice as an open
>>> source solution. Please note that this feature is only needed for
>>> development phase, in production, the scheduled task its ok.
>>>
>>> I mean time I tested with AS 5.3.0, JRebel and HotSwapAgent, JRebel
>>> trial worked as expected, but HotSwapAgent not (see exception bellow [1]),
>>> I will check these problems with HotSwapAgent devs, and try to discover why
>>> dont works with WSO2 AS as with HotSwapAgent active none of webapps load,
>>> all get that exception, as we see a NPE in class CarbonWebappClassLoader
>>> maybe its the way they initialize the dependent class loaders.
>>>
>>> [1] Exception when HotSwapAgent is active:
>>> [2016-01-22 09:14:18,467] ERROR {org.apache.catalina.core.ContainerBase}
>>> -  ContainerBase.addChild: start:
>>> org.apache.catalina.LifecycleException: Failed to start component
>>> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/example]]
>>>     at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
>>>     at
>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>>>     at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>>>     at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
>>>     at
>>> org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:344)
>>>     at
>>> org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:252)
>>>     at
>>> org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWebappDeployment(TomcatGenericWebappsDeployer.java:314)
>>>     at
>>> org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWarWebappDeployment(TomcatGenericWebappsDeployer.java:212)
>>>     at
>>> org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleHotDeployment(TomcatGenericWebappsDeployer.java:179)
>>>     at
>>> org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.deploy(TomcatGenericWebappsDeployer.java:144)
>>>     at
>>> org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deployThisWebApp(AbstractWebappDeployer.java:224)
>>>     at
>>> org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deploy(AbstractWebappDeployer.java:114)
>>>     at
>>> org.wso2.carbon.webapp.deployer.WebappDeployer.deploy(WebappDeployer.java:42)
>>>     at
>>> org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
>>>     at
>>> org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
>>>     at
>>> org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
>>>     at
>>> org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
>>>     at
>>> org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
>>>     at
>>> org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:135)
>>>     at
>>> org.wso2.carbon.core.CarbonAxisConfigurator.deployServices(CarbonAxisConfigurator.java:567)
>>>     at
>>> org.wso2.carbon.core.internal.DeploymentServerStartupObserver.completingServerStartup(DeploymentServerStartupObserver.java:51)
>>>     at
>>> org.wso2.carbon.core.internal.CarbonCoreServiceComponent.notifyBefore(CarbonCoreServiceComponent.java:235)
>>>     at
>>> org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.completeInitialization(StartupFinalizerServiceComponent.java:185)
>>>     at
>>> org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.serviceChanged(StartupFinalizerServiceComponent.java:288)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
>>>     at
>>> org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.registerThrottlingAgent(ThrottlingAgentServiceComponent.java:123)
>>>     at
>>> org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.activate(ThrottlingAgentServiceComponent.java:100)
>>>     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.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
>>>     at
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
>>>     at
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
>>>     at
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
>>>     at
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
>>>     at
>>> org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
>>>     at
>>> org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
>>>     at
>>> org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:517)
>>>     at
>>> org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
>>>     at
>>> org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:91)
>>>     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.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
>>>     at
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
>>>     at
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
>>>     at
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
>>>     at
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
>>>     at
>>> org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
>>>     at
>>> org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>>>     at
>>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
>>>     at
>>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
>>>     at
>>> org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
>>>     at
>>> org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
>>>     at
>>> org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
>>>     at
>>> org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
>>>     at
>>> org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
>>>     at
>>> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
>>>     at
>>> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
>>>     at
>>> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5262)
>>>     at
>>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5550)
>>>     at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>     at
>>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
>>>     at
>>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
>>>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>>>     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:745)
>>> Caused by: org.apache.catalina.LifecycleException: Failed to start
>>> component [WebappLoader[/example]]
>>>     at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
>>>     at
>>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5389)
>>>     at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>     ... 95 more
>>> Caused by: java.lang.NullPointerException
>>>     at
>>> org.wso2.carbon.webapp.mgt.loader.CarbonWebappClassLoader.getResources(CarbonWebappClassLoader.java:260)
>>>     at
>>> org.hotswap.agent.config.PluginConfiguration.<init>(PluginConfiguration.java:64)
>>>     at
>>> org.hotswap.agent.config.PluginManager.initClassLoader(PluginManager.java:155)
>>>     at
>>> org.hotswap.agent.config.PluginManager.initClassLoader(PluginManager.java:130)
>>>     at
>>> org.hotswap.agent.config.PluginRegistry.initializePlugin(PluginRegistry.java:139)
>>>     at
>>> org.hotswap.agent.util.PluginManagerInvoker.callInitializePlugin(PluginManagerInvoker.java:26)
>>>     at
>>> org.hotswap.agent.plugin.tomcat.TomcatPlugin.init(TomcatPlugin.java:91)
>>>     at
>>> org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:634)
>>>     at
>>> org.wso2.carbon.webapp.mgt.loader.CarbonWebappLoader.startInternal(CarbonWebappLoader.java:55)
>>>     at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>     ... 97 more
>>>
>>> TIA
>>> Clóvis
>>>
>>>
>>>
>>>
>>>
>>> 2016-01-22 5:32 GMT-02:00 Kishanthan Thangarajah <kishant...@wso2.com>:
>>>
>>>> Hi Clovis,
>>>>
>>>> On Wed, Jan 20, 2016 at 6:06 PM, Clovis Wichoski <clo...@neoinix.com.br
>>>> > wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm researching for some ways to improve speed of development and
>>>>> redeploy on WSO2 Application Server, for example I have a scenario here
>>>>> where a simple change on a class, to test, get about 5 minutes. (as the
>>>>> test must pass by web interfaces in Jaggery, until reach the REST Api
>>>>> implemented in JAX-RS with Jersey and some JPA using EclipseLink.
>>>>>
>>>>> The Jaggery part is very easy, just rsync files, and all works fine.
>>>>>
>>>>> For the java part, in this research I found the HotSwapAgent -
>>>>> http://www.hotswapagent.org/
>>>>>
>>>>> My first try was to follow HotSwapAgent quick start as is, and check
>>>>> if it works with WSO2 AS 5.2.1 out of the box, but dont worked,
>>>>> HotSwapAgent dont detect changes when I copy one updated .class file to
>>>>> WEB-INF/classes.
>>>>>
>>>>> Then my question is about, if anyone tried this before with WSO2, and
>>>>> if is a good way to invest time to implement a WSO2 plugin that work 
>>>>> better
>>>>> with HotSwapAgent and what is the steps I must follow to implement this
>>>>> plugin or integrate this type of speed with redeploy with WSO2 AS? Maybe
>>>>> some problems with OSGi?
>>>>>
>>>>
>>>> This is a good thing to have with webap deployment. But we do have a
>>>> concept of hot update of webapps which is the default behaviour. If you
>>>> update the webapp, it will be redeployed by the Application Server where it
>>>> keeps track of the changes using the scheduled task which runs on every 15
>>>> seconds interval. Since this redeploys the entire webapp, all the classes
>>>> loaded will be removed and will be loaded again. Do find any issues with
>>>> this behaviour?
>>>>
>>>> Thanks,
>>>> Kishanthan.
>>>>
>>>>
>>>>> ps: Note that the idea, is just change one class, rsync the binary
>>>>> .class file over respective WEB-INF/classes and got the results.
>>>>>
>>>>> Best regards
>>>>>
>>>>> Clóvis Wichoski
>>>>> CEO, Neoinix
>>>>> Mobile: +554588233181
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Kishanthan Thangarajah*
>>>> Associate Technical Lead,
>>>> Platform Technologies Team,
>>>> WSO2, Inc.
>>>> lean.enterprise.middleware
>>>>
>>>> Mobile - +94773426635
>>>> Blog - *http://kishanthan.wordpress.com
>>>> <http://kishanthan.wordpress.com>*
>>>> Twitter - *http://twitter.com/kishanthan
>>>> <http://twitter.com/kishanthan>*
>>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thusitha Dayaratne
>> Software Engineer
>> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>
>> Mobile  +94712756809
>> Blog      alokayasoya.blogspot.com
>> About    http://about.me/thusithathilina
>>
>>
>
>
> --
> Thusitha Dayaratne
> Software Engineer
> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>
> Mobile  +94712756809
> Blog      alokayasoya.blogspot.com
> About    http://about.me/thusithathilina
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to