You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Kirk Spencer <ks...@playboox.com> on 2008/04/02 23:09:32 UTC

Changing default jetty port for cxf component.

Greetings,

I have deployed SM WEB 3.2.1 on Tomcat.  There I have an assembly deployed
that uses the cxf components (bridge from cxfse - cxfbc).  Whenever I deploy
any of these assemblies a Jetty server instance is started on port 80.

Questions:
1. Is Jetty a requirement by CXF components?
2. If so, can I configure it to use another port?

Here is the xbean configuration:


<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"

xmlns:myns="urn:bridge.test.com">

<classpath>

<location>.</location>

</classpath>

<cxfbc:consumer wsdl="classpath:bridge.wsdl"

service="myns:BridgeService"

endpoint="BridgeService"

targetService="myns:BridgeService"

targetInterface="myns:BridgePort"

targetEndpoint="BridgePort"

busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->

<cxfbc:inInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>

</cxfbc:inInterceptors>

<cxfbc:outInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

</cxfbc:outInterceptors>

<cxfbc:inFaultInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>

</cxfbc:inFaultInterceptors>

<cxfbc:outFaultInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

</cxfbc:outFaultInterceptors>

</cxfbc:consumer>

<cxfbc:provider wsdl="classpath:bridge.wsdl"

locationURI=http://localhost/BridgeService

service="myns:BridgeService"

interfaceName="myns:BridgePort"

endpoint="BridgePort"

busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->

<cxfbc:inInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>

</cxfbc:inInterceptors>

<cxfbc:outInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

</cxfbc:outInterceptors>

<cxfbc:inFaultInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>

</cxfbc:inFaultInterceptors>

<cxfbc:outFaultInterceptors>

<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

</cxfbc:outFaultInterceptors>

</cxfbc:provider>

</beans>

Thanks.
-Kirk

Re: Changing default jetty port for cxf component.

Posted by Kirk Spencer <ks...@playboox.com>.
Many Thanks for the responses they definitely helped.

I will try the servlet transport when I can implement an upgrade to the
3.2.2 release.

With regards to the CXF Jetty instance, the instance does not respond to the
Tomcat shutdown command even though the Tomcat process is its parent
process.  So I have to kill the parent process manually.

Is there a way to shutdown the CXF Jetty instance when its parent Tomcat
instance is shutdown?


On Wed, Apr 2, 2008 at 11:57 PM, Freeman Fang <fr...@gmail.com>
wrote:

> Hi Kirk,
>
> comment inline
>
> Kirk Spencer wrote:
>
> > Greetings,
> >
> > I have deployed SM WEB 3.2.1 on Tomcat.  There I have an assembly
> > deployed
> > that uses the cxf components (bridge from cxfse - cxfbc).  Whenever I
> > deploy
> > any of these assemblies a Jetty server instance is started on port 80.
> >
> > Questions:
> > 1. Is Jetty a requirement by CXF components?
> >
> >
> no, you can use servlet transport when you deploy it into servlet
> container such as tomcat.
> You need add
> <servlet>
>       <servlet-name>cxf</servlet-name>
>       <display-name>cxf</display-name>
>       <description>Apache CXF Endpoint</description>
>
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>       <load-on-startup>1</load-on-startup>
>   </servlet>
>   <servlet-mapping>
>       <servlet-name>cxf</servlet-name>
>       <url-pattern>/services/*</url-pattern>
>   </servlet-mapping>
> to the /webapps/apache-servicemix-web-3.2.2/WEB-INF/web.xml
> this servlet just replace http transport with servlet transport, so that
> you can avoid starting jetty server when start cxf bc consumer, just reuse
> the http server provided by your servlet container,
> Also, you need add
> locationURI="/whateveryouwant"
> for your cxf bc consumer configuration
> then you can access the wsdl by
>
> http://localhost:8080/apache-servicemix-web-3.2.2/services/whateveryouwant?wsdl
>
> Btw, there is an issue [1] to prevent the transport replacement in smx, I
> will fix it up asap
>
> [1]https://issues.apache.org/activemq/browse/SM-1301
>
> 2. If so, can I configure it to use another port?
> >
> >
> >
> we still provide locationURI attribute both for provider and consumer if
> you want to override the address defined in wsdl,
> e.g. in wsdl the address is
> http://localhost:8080/service
> you can override it by
> locationURI="http://localhost:8800/service"
>
> Here is the xbean configuration:
> >
> >
> > <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
> >
> > xmlns:myns="urn:bridge.test.com">
> >
> > <classpath>
> >
> > <location>.</location>
> >
> > </classpath>
> >
> > <cxfbc:consumer wsdl="classpath:bridge.wsdl"
> >
> > service="myns:BridgeService"
> >
> > endpoint="BridgeService"
> >
> > targetService="myns:BridgeService"
> >
> > targetInterface="myns:BridgePort"
> >
> > targetEndpoint="BridgePort"
> >
> > busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
> >
> > <cxfbc:inInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> >
> > </cxfbc:inInterceptors>
> >
> > <cxfbc:outInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
> >
> > </cxfbc:outInterceptors>
> >
> > <cxfbc:inFaultInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> >
> > </cxfbc:inFaultInterceptors>
> >
> > <cxfbc:outFaultInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
> >
> > </cxfbc:outFaultInterceptors>
> >
> > </cxfbc:consumer>
> >
> > <cxfbc:provider wsdl="classpath:bridge.wsdl"
> >
> > locationURI=http://localhost/BridgeService
> >
> > service="myns:BridgeService"
> >
> > interfaceName="myns:BridgePort"
> >
> > endpoint="BridgePort"
> >
> > busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
> >
> > <cxfbc:inInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> >
> > </cxfbc:inInterceptors>
> >
> > <cxfbc:outInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
> >
> > </cxfbc:outInterceptors>
> >
> > <cxfbc:inFaultInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> >
> > </cxfbc:inFaultInterceptors>
> >
> > <cxfbc:outFaultInterceptors>
> >
> > <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
> >
> > </cxfbc:outFaultInterceptors>
> >
> > </cxfbc:provider>
> >
> > </beans>
> >
> > Thanks.
> > -Kirk
> >
> >
> >
>
>


-- 

Kirk Spencer
Playboox | Senior Software Engineer

Re: Changing default jetty port for cxf component.

Posted by Freeman Fang <fr...@gmail.com>.
Hi Kirk,

comment inline

Kirk Spencer wrote:
> Greetings,
>
> I have deployed SM WEB 3.2.1 on Tomcat.  There I have an assembly deployed
> that uses the cxf components (bridge from cxfse - cxfbc).  Whenever I deploy
> any of these assemblies a Jetty server instance is started on port 80.
>
> Questions:
> 1. Is Jetty a requirement by CXF components?
>   
no, you can use servlet transport when you deploy it into servlet 
container such as tomcat.
You need add
 <servlet>
        <servlet-name>cxf</servlet-name>
        <display-name>cxf</display-name>
        <description>Apache CXF Endpoint</description>
        
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>cxf</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
to the /webapps/apache-servicemix-web-3.2.2/WEB-INF/web.xml
this servlet just replace http transport with servlet transport, so that 
you can avoid starting jetty server when start cxf bc consumer, just 
reuse the http server provided by your servlet container,
Also, you need add
locationURI="/whateveryouwant"
for your cxf bc consumer configuration
then you can access the wsdl by
http://localhost:8080/apache-servicemix-web-3.2.2/services/whateveryouwant?wsdl

Btw, there is an issue [1] to prevent the transport replacement in smx, 
I will fix it up asap

[1]https://issues.apache.org/activemq/browse/SM-1301

> 2. If so, can I configure it to use another port?
>
>   
we still provide locationURI attribute both for provider and consumer if 
you want to override the address defined in wsdl,
e.g. in wsdl the address is
http://localhost:8080/service
you can override it by
locationURI="http://localhost:8800/service"
> Here is the xbean configuration:
>
>
> <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>
> xmlns:myns="urn:bridge.test.com">
>
> <classpath>
>
> <location>.</location>
>
> </classpath>
>
> <cxfbc:consumer wsdl="classpath:bridge.wsdl"
>
> service="myns:BridgeService"
>
> endpoint="BridgeService"
>
> targetService="myns:BridgeService"
>
> targetInterface="myns:BridgePort"
>
> targetEndpoint="BridgePort"
>
> busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
>
> <cxfbc:inInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inInterceptors>
>
> <cxfbc:outInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outInterceptors>
>
> <cxfbc:inFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inFaultInterceptors>
>
> <cxfbc:outFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outFaultInterceptors>
>
> </cxfbc:consumer>
>
> <cxfbc:provider wsdl="classpath:bridge.wsdl"
>
> locationURI=http://localhost/BridgeService
>
> service="myns:BridgeService"
>
> interfaceName="myns:BridgePort"
>
> endpoint="BridgePort"
>
> busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
>
> <cxfbc:inInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inInterceptors>
>
> <cxfbc:outInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outInterceptors>
>
> <cxfbc:inFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inFaultInterceptors>
>
> <cxfbc:outFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outFaultInterceptors>
>
> </cxfbc:provider>
>
> </beans>
>
> Thanks.
> -Kirk
>
>   


Re: Changing default jetty port for cxf component.

Posted by Guillaume Nodet <gn...@gmail.com>.
On Wed, Apr 2, 2008 at 11:09 PM, Kirk Spencer <ks...@playboox.com> wrote:

> Greetings,
>
> I have deployed SM WEB 3.2.1 on Tomcat.  There I have an assembly deployed
> that uses the cxf components (bridge from cxfse - cxfbc).  Whenever I
> deploy
> any of these assemblies a Jetty server instance is started on port 80.
>
> Questions:
> 1. Is Jetty a requirement by CXF components?


Currently yes.  I suppose you may be able to use the servlet transport too,
in which case it would reuse the Tomcat, but I've never done that and I'm
not sure if it's possible right now.

>
> 2. If so, can I configure it to use another port?
>

Have you tried changing the endpoint address in the wsdl ?
   http://localhost:8192/MyService
for example ?


>
> Here is the xbean configuration:
>
>
> <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>
> xmlns:myns="urn:bridge.test.com">
>
> <classpath>
>
> <location>.</location>
>
> </classpath>
>
> <cxfbc:consumer wsdl="classpath:bridge.wsdl"
>
> service="myns:BridgeService"
>
> endpoint="BridgeService"
>
> targetService="myns:BridgeService"
>
> targetInterface="myns:BridgePort"
>
> targetEndpoint="BridgePort"
>
> busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
>
> <cxfbc:inInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inInterceptors>
>
> <cxfbc:outInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outInterceptors>
>
> <cxfbc:inFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inFaultInterceptors>
>
> <cxfbc:outFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outFaultInterceptors>
>
> </cxfbc:consumer>
>
> <cxfbc:provider wsdl="classpath:bridge.wsdl"
>
> locationURI=http://localhost/BridgeService
>
> service="myns:BridgeService"
>
> interfaceName="myns:BridgePort"
>
> endpoint="BridgePort"
>
> busCfg="cxf.xml"> <!-- busCfg DOES NOT SEEM TO WORK -->
>
> <cxfbc:inInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inInterceptors>
>
> <cxfbc:outInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outInterceptors>
>
> <cxfbc:inFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>
> </cxfbc:inFaultInterceptors>
>
> <cxfbc:outFaultInterceptors>
>
> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> </cxfbc:outFaultInterceptors>
>
> </cxfbc:provider>
>
> </beans>
>
> Thanks.
> -Kirk
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/