Hi Bart,
You may find the example by taking a look at CXF Jetty systest[1]
[1]https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Cheers,
Willem
Bart Couvreur wrote:
Hi all,
I'm creating a system that exposes web services based on Spring
configuration files that load up client-proxies to different services
(mainly HTTP invokers). I'm using the simple frontend, so people don't
have to annotate their service layers and Aegis databinding.
This requires a lot of redeploying (currently using JBoss AS 4.2.1 GA),
but Jetty always fails to load on a redeploy due to the destination port
being assigned.
I've tried adding a destroy-method, to make sure services are stopped,
but no avail.
Ideas, suggestions welcome!
Thanks,
Bart
Partial stacktrace:
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'chaosConfig' defined in class path resource
[be/kahosl/chaos/adaptor/context/chaosContext.xml]: Invocation of init method
failed; nested exception is org.apache.cxf.interceptor.Fault: Could not start
Jetty server: Address already in use
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1260)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:438)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 108 more
Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server:
Address already in use
at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:312)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:150)
at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:47)
at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:166)
at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:674)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:122)
at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:129)
at
be.kahosl.chaos.adaptor.remoting.BasicAuthCommonsHttpInvokerProxy.exportServices(BasicAuthCommonsHttpInvokerProxy.java:102)
at
be.kahosl.chaos.adaptor.remoting.AbstractServiceProxy.afterPropertiesSet(AbstractServiceProxy.java:92)
at
be.kahosl.chaos.adaptor.remoting.BasicAuthCommonsHttpInvokerProxy.afterPropertiesSet(BasicAuthCommonsHttpInvokerProxy.java:51)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 117 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind(Native Method)
at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:205)
at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:304)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.Server.doStart(Server.java:233)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:290)
... 128 more