Port already in use when using CXF consumer and jetty

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Port already in use when using CXF consumer and jetty

Castyn
I am getting the following error when deploying a bundle which contains a CXF consumer for a web service as well as a simple jetty endpoint.

org.apache.camel.RuntimeCamelException: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 9,191: Address already in use

Here is what the CXF consumer bean looks like, there is a route that starts with it in the context:

        <cxf:cxfEndpoint
                id="initiateCXFConsumer"
                address="http://0.0.0.0:9191/JavelinInitiateService"
                wsdlURL="wsdl/initiate.wsdl"
                serviceClass="com.ihg.webservice.JavelinInitiateService">
            <entry key="receiveTimeout" value="120000"/>
              <entry key="connectionTimeout" value="120000"/>
                    <entry key="schema-validation-enabled" value="true" />
                    <entry key="faultStackTraceEnabled" value="false" />
                </cxf:properties>
        </cxf:cxfEndpoint>

I also have this jetty endpoint I have added that is causing the issue:

                <route id="Ping">
                        <from uri="jetty:http://0.0.0.0:9191/ping"/>
                <setBody>
                    <simple>${date:now:yyyy-MM-dd'T'HH:mm:ss:SSS}</simple>
                </setBody>
                       
                </route>

I know the CXF consumers use jetty underneath, so I am not sure what is wrong with this that causes the collision.  In the camel-beans.xml where the cxf consumer is configured, I have included the following


        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
        <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

Anyone have any idea what might be going wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Port already in use when using CXF consumer and jetty

Willem.Jiang
Administrator
camel-jetty and cxf endpoint cannot share the same jetty server at the
same time.
You have to change the port to avoid this kind of error.

On Wed Jun 13 01:43:52 2012, Castyn wrote:

> I am getting the following error when deploying a bundle which contains a CXF
> consumer for a web service as well as a simple jetty endpoint.
>
> org.apache.camel.RuntimeCamelException: org.apache.cxf.interceptor.Fault:
> Could not start Jetty server on port 9,191: Address already in use
>
> Here is what the CXF consumer bean looks like, there is a route that starts
> with it in the context:
>
> <cxf:cxfEndpoint
>        id="initiateCXFConsumer"
>        address="http://0.0.0.0:9191/JavelinInitiateService"
>        wsdlURL="wsdl/initiate.wsdl"
>        serviceClass="com.ihg.webservice.JavelinInitiateService">
>     <entry key="receiveTimeout" value="120000"/>
>     <entry key="connectionTimeout" value="120000"/>
> <entry key="schema-validation-enabled" value="true" />
> <entry key="faultStackTraceEnabled" value="false" />
> </cxf:properties>
> </cxf:cxfEndpoint>
>
> I also have this jetty endpoint I have added that is causing the issue:
>
> <route id="Ping">
> <from uri="jetty:http://0.0.0.0:9191/ping"/>
> <setBody>
> <simple>${date:now:yyyy-MM-dd'T'HH:mm:ss:SSS}</simple>
> </setBody>
>
> </route>
>
> I know the CXF consumers use jetty underneath, so I am not sure what is
> wrong with this that causes the collision.  In the camel-beans.xml where the
> cxf consumer is configured, I have included the following
>
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
>
> Anyone have any idea what might be going wrong?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Port-already-in-use-when-using-CXF-consumer-and-jetty-tp5714378.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Reply | Threaded
Open this post in threaded view
|

Re: Port already in use when using CXF consumer and jetty

jjathman
Is this still the case? I was hoping to have a CXF web service as well as a Jetty Rest endpoint using the new rest DSL in Camel 2.14. Is there any way to reuse the Jetty server? I would rather not have multiple ports for a single JVM.
Reply | Threaded
Open this post in threaded view
|

Re: Port already in use when using CXF consumer and jetty

Castyn
I ended up writing an internal router to solve this.  You can setup a jetty listener on the port you want and read the URL to determine which internal port to route the message to.  So internally I use ports 9191 - 9196 for various services and just send requests internally to those after determined destination based off URL, which I have mapped in a properties file.

On Thu, Feb 19, 2015 at 6:35 AM, jjathman [via Camel] <[hidden email]> wrote:
Is this still the case? I was hoping to have a CXF web service as well as a Jetty Rest endpoint using the new rest DSL in Camel 2.14. Is there any way to reuse the Jetty server? I would rather not have multiple ports for a single JVM.


If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Port-already-in-use-when-using-CXF-consumer-and-jetty-tp5714378p5762911.html
To unsubscribe from Port already in use when using CXF consumer and jetty, click here.
NAML