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:
<?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>
It's worked, server was registered (call JAXRSServerFactoryBean#create).
Next step: uninstal this bundle. All methods with annotation @PreDestroy
called, but notJAXRSServerFactoryBean#destroy (and not
callSpringApplicationContext#close).
When I again deploy this bundle, I get the error:
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)
Аny help would be appreciated!
Regards
Anton