Hi Christian,

Both bundles are separately competing for the same port - so whoever gets it first wins, and the loser then complains. AFAIK, this will happen for both HTTP and HTTPS ports; I'm not sure of a way to share the port using the normal CXF configuration.

However, you could just configure the CXF services to use the OSGi HTTP service from ServiceMix, and then put your SSL/TLS configuration on that port. Would that work for you?

Cheers,
Ade

On 10/02/2011 13:42, Christian Mueller wrote:

Hello list!

In our ServiceMix 4.2.0-fuse-02-00 we deployed multiple Camel bundles which
provides web services using Apache Camel. In the first phase we used http
for all services. All services used the same port number and different
context paths.
In phase two, we tried to switch all endpoints to https with the following
(general) configuration:

{code}
        <camel-cxf:cxfEndpoint id="orderEntryEndpoint"
                address="https://0.0.0.0:8443:/Services/OrderEntry";
                serviceClass="com.xxx.yyy.interfaces.oe.OrderEntryWebService"
                endpointName="ssp:OrderEntryPort"
                serviceName="ssp:OrderEntryService"
                wsdlURL="META-INF/oe/orderEntry.wsdl"
                xmlns:ssp="http://www.xxx.com/oe/services/2";>

                <camel-cxf:properties>
                        <entry key="schema-validation-enabled" value="true" />
                </camel-cxf:properties>
        </camel-cxf:cxfEndpoint>

        <httpj:engine-factory bus="cxf">
                <httpj:engine port="8443">
                        <httpj:tlsServerParameters>
                                <sec:keyManagers keyPassword="password">
                                        <sec:keyStore type="JKS" password="password" 
file="keyStore.jks" />
                                </sec:keyManagers>
                                <sec:cipherSuitesFilter>
                                        <sec:include>.*.*</sec:include>
                                </sec:cipherSuitesFilter>
                                <sec:clientAuthentication want="false" 
required="false" />
                        </httpj:tlsServerParameters>
                </httpj:engine>
        </httpj:engine-factory>
{code}

But now, we receive the following exception when we deploy the second
service (using the same https port):

{code}
karaf@root>  Exception in thread "SpringOsgiExtenderThread-25"
org.apache.camel.RuntimeCamelException: org.apache.cxf.intercep
tor.Fault: Could not start Jetty server: Address already in use: JVM_Bind
         at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1055)
         at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
         at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:593)
         at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:7
8)
         at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
         at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticast
er.java:76)
         at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
         at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
         at
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleAppl
icationContext.java:235)
         at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecu
tionApplicationContext.java:358)
         at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
         at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDele
gatedExecutionApplicationContext.java:320)
         at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$Complet
eRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
         at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server:
Address already in use: JVM_Bind
         at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:371)
         at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:167)
         at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)
         at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:164)
         at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:807)
         at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:127)
         at
org.apache.camel.component.cxf.CxfConsumer.doStart(CxfConsumer.java:122)
         at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:53)
         at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
         at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:989)
         at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:197)
         at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
         ... 12 more
Caused by: java.net.BindException: Address already in use: JVM_Bind
         at java.net.PlainSocketImpl.socketBind(Native Method)
         at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
         at java.net.ServerSocket.bind(ServerSocket.java:319)
         at java.net.ServerSocket.<init>(ServerSocket.java:185)
         at java.net.ServerSocket.<init>(ServerSocket.java:141)
         at javax.net.ssl.SSLServerSocket.<init>(SSLServerSocket.java:84)
         at
com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.<init>(SSLServerSocketImpl.java:79)
         at
com.sun.net.ssl.internal.ssl.SSLServerSocketFactoryImpl.createServerSocket(SSLServerSocketFactoryImpl.java:65)
         at
org.mortbay.jetty.security.SslSocketConnector.newServerSocket(SslSocketConnector.java:450)
         at
org.apache.cxf.transport.https_jetty.CXFJettySslSocketConnector.newServerSocket(CXFJettySslSocketConnector.java:13
9)
         at
org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
         at
org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
         at
org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
         at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
         at org.mortbay.jetty.Server.doStart(Server.java:235)
         at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
         at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:338)
         ... 23 more

{code}

Did we something wrong? Is there another possible configuration which works?

Thanks in advance for any help,
Christian

Reply via email to