[ 
https://issues.apache.org/jira/browse/ARIES-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15842563#comment-15842563
 ] 

Anton Deripaska edited comment on ARIES-1673 at 1/27/17 11:07 AM:
------------------------------------------------------------------

Yes, in my case it worked correctly. SpringBeanProcessor#beforeDestroy can be 
empty now.

But, after destroy SpringContext get:
{quote}
2017-01-27 14:04:14,869 | WARN  | raf-4.0.8/deploy | SpringApplicationContext   
      | 1373 - org.apache.servicemix.bundles.spring-context - 4.2.8.RELEASE_1 | 
Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 
'refresh' before invoking lifecycle methods via the context: 
org.apache.aries.blueprint.spring.SpringApplicationContext@828ad58: startup 
date [Fri Jan 27 14:03:54 MSK 2017]; root of context hierarchy
        at 
org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:415)
        at 
org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:975)
        at 
org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
        at 
org.springframework.context.support.AbstractApplicationContext.destroy(AbstractApplicationContext.java:921)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)[:1.8.0_121]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_121]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_121]
        at 
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BeanRecipe.destroy(BeanRecipe.java:887)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.destroy(BlueprintRepository.java:329)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.destroyComponents(BlueprintContainerImpl.java:765)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.tidyupComponents(BlueprintContainerImpl.java:964)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.destroy(BlueprintContainerImpl.java:909)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintExtender$3.run(BlueprintExtender.java:325)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
        at 
org.apache.aries.blueprint.container.BlueprintExtender.destroyContainer(BlueprintExtender.java:346)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:238)[12:org.apache.aries.blueprint.core:1.7.1]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[21:org.apache.aries.util:1.1.1]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[21:org.apache.aries.util:1.1.1]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[21:org.apache.aries.util:1.1.1]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[21:org.apache.aries.util:1.1.1]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[21:org.apache.aries.util:1.1.1]
        at 
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.Felix.stopBundle(Felix.java:2600)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.Felix.uninstallBundle(Felix.java:2712)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.framework.BundleImpl.uninstall(BundleImpl.java:1055)[org.apache.felix.framework-5.6.1.jar:]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:1090)[4:org.apache.felix.fileinstall:3.5.6]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.uninstall(DirectoryWatcher.java:888)[4:org.apache.felix.fileinstall:3.5.6]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:483)[4:org.apache.felix.fileinstall:3.5.6]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)[4:org.apache.felix.fileinstall:3.5.6]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)[4:org.apache.felix.fileinstall:3.5.6]
{quote}


was (Author: anton.deripaska):
Yes, in my case it worked correctly. SpringBeanProcessor#beforeDestroy can be 
empty now.

> Spring beans not destroyed
> --------------------------
>
>                 Key: ARIES-1673
>                 URL: https://issues.apache.org/jira/browse/ARIES-1673
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-spring-0.2.0
>            Reporter: Anton Deripaska
>            Assignee: Guillaume Nodet
>            Priority: Critical
>             Fix For: blueprint-spring-0.3.0
>
>
> Hello everyone!
> I have some problem with undeploy bundle using Blueprint Spring. 
> If properly understood it, SpringApplicationContext NOT destroy when bundle 
> uninstall.
> For example, simple bundle with jax-rs:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xmlns:context="http://www.springframework.org/schema/context";
>        xmlns:jaxrs="http://cxf.apache.org/jaxrs";
>        xsi:schemaLocation="
>              http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans.xsd
>              http://www.springframework.org/schema/context 
> http://www.springframework.org/schema/context/spring-context.xsd
>              http://cxf.apache.org/jaxrs 
> http://cxf.apache.org/schemas/jaxrs.xsd
> ">
>     <context:annotation-config/>
>     <jaxrs:server id="test" address="/test">
>         <jaxrs:serviceBeans>
>             <ref bean="rs-test"/>
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
>     <bean id="rs-test" class="com.dob.ams.osgi.service.TestRestService"/>
> </beans>
> {code}
> It's worked, server was registered (call JAXRSServerFactoryBean#create).
> Next step: uninstal this bundle. All methods with annotation @PreDestroy 
> called, but not JAXRSServerFactoryBean#destroy (and not call 
> SpringApplicationContext#close).
>  
> When I again deploy this bundle, I get the error:
> {quote}
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException: There 
> is an endpoint already running on /test.
>       at 
> org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:86)
>       at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123)
>       at 
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:206)
> {quote}
> Аny help would be appreciated!
> Regards
> Anton



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to