You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by snatera <sn...@divux.com> on 2012/02/06 20:31:45 UTC

Re: Problem with multiple CXF services using the same https port

Hi cristian,

I am working with apache camel and i would like to configure https in the
route.
can you help me with this?

This is my beans.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:cxf="http://camel.apache.org/schema/cxf"
   
xmlns:cc="http://www.cnti.gob.ve/servicio/ServicioDirectorioEstadoVenezolano"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd
        http://camel.apache.org/schema/cxf
        http://camel.apache.org/schema/cxf/camel-cxf.xsd
    ">

    <cxf:cxfEndpoint id="servicio_web_bus"
address="http://localhost:9003/servicios"
        wsdlURL="ServicioDirectorioEstadoVenezolano.wsdl"
        serviceName="cc:ServicioDirectorioEstadoVenezolano"
endpointName="cc:ServicioDirectorioEstadoVenezolanoUbicacion">
         <cxf:properties>
		      <entry key="dataFormat" value="MESSAGE"/>
  	     </cxf:properties> 
    </cxf:cxfEndpoint> 

    <cxf:cxfEndpoint id="servicio_web"
address="http://192.168.0.128:8080/cnti_servicios/ServicioDirectorioEstadoVenezolano"
         wsdlURL="ServicioDirectorioEstadoVenezolano.wsdl"
         serviceName="cc:ServicioDirectorioEstadoVenezolano"
endpointName="cc:ServicioDirectorioEstadoVenezolanoUbicacion">
          <cxf:properties>
		      <entry key="dataFormat" value="MESSAGE"/>
	      </cxf:properties>
    </cxf:cxfEndpoint>
	
    <camelContext id="converter"
xmlns="http://camel.apache.org/schema/spring" >
        <route streamCache="true">
            <from uri="cxf:bean:servicio_web_bus" />
            <to uri="cxf:bean:servicio_web" /> 
        </route>
    </camelContext>

</beans>

I hope for your response.

Thank you



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5461039.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with multiple CXF services using the same https port

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday, February 09, 2012 5:47:09 AM snatera wrote:
> Hello Dan!
> 
> Thanks for taking your time to reply to me.
> 
> In this link Fuse Source explains the way that I implemented:
> http://fusesource.com/docs/esb/4.3/cxf_security/HTTPCompatible.html#i488847

Nice of them to promote the use of generally bad ideas...   :-(


> I was trying to use <import resource="classpath:META-INF/cxf/cxf.xml" />
> before, but I had this Exception:
> 
> -- Exception in thread "SpringOsgiExtenderThread-29"
> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find
> class [org.apache.cxf.bus.spring.SpringBus] for bean with name 'cxf' defined
> in OSGi
> resource[classpath:META-INF/cxf/cxf.xml|bnd.id=219|bnd.sym=cnti-sw-dev-https
> ]; nested exception is java.lang.ClassNotFoundException:
> org.apache.cxf.bus.spring.SpringBus not found from bundle [my-bundle] --

You likely need to either add some imports (org.apache.cxf.bus.spring) or add 
a "Require-Bundle: org.apache.cxf.bundle" header to the manifest.    
Definitely one of the more annoying things about spring-dm.

 
> And.. if I do this <cxf:bus name="cxf"/> I get this Exception:
> 
>  --  org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 24 in XML document from URL
> [bundle://219.29:0/META-INF/spring/beans.xml] is invalid; nested exception
> is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching
> wildcard is strict, but no declaration can be found for element 'cxf:bus'.

This is easier....  You need to update the schemaLocation attribute on the 
root beans to add 

"http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"

to the list of namespaces to map to a schema for validation purposes.

Dan



> --
> 
> What can I do to solve this?
> Thanks a lot,
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-
> the-same-https-port-tp3379301p5469462.html Sent from the Camel - Users
> mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Problem with multiple CXF services using the same https port

Posted by Willem Jiang <wi...@gmail.com>.
As Dan suggested, CXF already does some hacking itself to setup a right 
class loader.
You don't need to import lots of CXF related package in your bundle.

On Thu Feb  9 03:25:38 2012, Daniel Kulp wrote:
> On Wednesday, February 08, 2012 11:10:35 AM snatera wrote:
>>   I could solve the last post, where I mention the Exception about 'cxf'
>> bean.
>>
>> In your beans.xml or camel-config.xml you have to put this source:
>>
>>          <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
>
> Please do not do that.   That's a surefire way to make sure you'll have
> configuration issues, strange errors, and issues upgrading to newer versions
> of CXF.
>
> Just import:
> <import resource="classpath:META-INF/cxf/cxf.xml" />
>
> or do a:
>
> <cxf:bus name="cxf"/>
>
> And let CXF setup the bus.  CXFBusImpl is not spring aware and is also not
> even CXF extension aware.  Thus, it's quite likely that nothing using that bus
> will even work.
>
>
> Dan
>
>
>
>>
>> Then, go to pom.xml and put this dependendy and this import:
>>
>> Dependency:
>>
>>          <dependency>
>>              <groupId>org.apache.camel</groupId>
>>              <artifactId>camel-cxf</artifactId>
>>              <version>${camel.version}</version>
>>          </dependency>
>>
>> Import:
>>
>>          <Import-Package>
>>                  ...,
>>                  org.apache.cxf.bus
>>          </Import-Package>
>>
>>
>> This way I could solve it.
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-
>> the-same-https-port-tp3379301p5467423.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 


Re: Problem with multiple CXF services using the same https port

Posted by snatera <sn...@divux.com>.
Hello Dan!

Thanks for taking your time to reply to me.

In this link Fuse Source explains the way that I implemented:
http://fusesource.com/docs/esb/4.3/cxf_security/HTTPCompatible.html#i488847

I was trying to use <import resource="classpath:META-INF/cxf/cxf.xml" />
before, but I had this Exception: 

-- Exception in thread "SpringOsgiExtenderThread-29"
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find
class [org.apache.cxf.bus.spring.SpringBus] for bean with name 'cxf' defined
in OSGi
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=219|bnd.sym=cnti-sw-dev-https];
nested exception is java.lang.ClassNotFoundException:
org.apache.cxf.bus.spring.SpringBus not found from bundle [my-bundle] --

And.. if I do this <cxf:bus name="cxf"/> I get this Exception:

 --  org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 24 in XML document from URL
[bundle://219.29:0/META-INF/spring/beans.xml] is invalid; nested exception
is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching
wildcard is strict, but no declaration can be found for element 'cxf:bus'.
--

What can I do to solve this? 
Thanks a lot,

--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5469462.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with multiple CXF services using the same https port

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday, February 08, 2012 11:10:35 AM snatera wrote:
>  I could solve the last post, where I mention the Exception about 'cxf'
> bean.
> 
> In your beans.xml or camel-config.xml you have to put this source:
> 
>         <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>

Please do not do that.   That's a surefire way to make sure you'll have 
configuration issues, strange errors, and issues upgrading to newer versions 
of CXF.

Just import:
<import resource="classpath:META-INF/cxf/cxf.xml" />

or do a:

<cxf:bus name="cxf"/>

And let CXF setup the bus.  CXFBusImpl is not spring aware and is also not 
even CXF extension aware.  Thus, it's quite likely that nothing using that bus 
will even work.   


Dan



> 
> Then, go to pom.xml and put this dependendy and this import:
> 
> Dependency:
> 
>         <dependency>
>             <groupId>org.apache.camel</groupId>
>             <artifactId>camel-cxf</artifactId>
>             <version>${camel.version}</version>
>         </dependency>
> 
> Import:
> 
>         <Import-Package>
>                 ...,
>                 org.apache.cxf.bus
>         </Import-Package>
> 
> 
> This way I could solve it.
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-
> the-same-https-port-tp3379301p5467423.html Sent from the Camel - Users
> mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Problem with multiple CXF services using the same https port

Posted by snatera <sn...@divux.com>.
 I could solve the last post, where I mention the Exception about 'cxf' bean.

In your beans.xml or camel-config.xml you have to put this source:

        <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>

Then, go to pom.xml and put this dependendy and this import:

Dependency:

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-cxf</artifactId>
            <version>${camel.version}</version>
        </dependency>

Import:

        <Import-Package>
                ...,
                org.apache.cxf.bus
        </Import-Package>


This way I could solve it.

--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5467423.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with multiple CXF services using the same https port

Posted by snatera <sn...@divux.com>.
 Thank you for share this link.

I have a Exception with this example, it's about Bus attribute in
httpj:engine-factory element, the example defined it this way
httpj:engine-factory bus="cxf", but when I install this bundle in
fuse-esb-servicemix I have this exception:

-- Error creating bean with name
'org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory': Cannot
resolve reference to bean 'cxf' while setting constructor argument; nested
exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'cxf' is defined --

This exception has some logic, but in the example, they don't define a 'cxf'
bean. 
Could you help me what do I have to do in this case?

--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5466997.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with multiple CXF services using the same https port

Posted by "Moulliard, Charles" <cm...@fusesource.com>.
Hi,

You can follow instructions explained here :

http://fusesource.com/docs/esb/4.4.1/esb_security/CamelCXF-SecureProxy.html

Regards,

Charles

On Mon, Feb 6, 2012 at 8:31 PM, snatera <sn...@divux.com> wrote:

> Hi cristian,
>
> I am working with apache camel and i would like to configure https in the
> route.
> can you help me with this?
>
> This is my beans.xml:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:cxf="http://camel.apache.org/schema/cxf"
>
> xmlns:cc="
> http://www.cnti.gob.ve/servicio/ServicioDirectorioEstadoVenezolano"
>     xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
>        http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://camel.apache.org/schema/spring
>        http://camel.apache.org/schema/spring/camel-spring.xsd
>        http://camel.apache.org/schema/cxf
>        http://camel.apache.org/schema/cxf/camel-cxf.xsd
>    ">
>
>    <cxf:cxfEndpoint id="servicio_web_bus"
> address="http://localhost:9003/servicios"
>        wsdlURL="ServicioDirectorioEstadoVenezolano.wsdl"
>        serviceName="cc:ServicioDirectorioEstadoVenezolano"
> endpointName="cc:ServicioDirectorioEstadoVenezolanoUbicacion">
>         <cxf:properties>
>                      <entry key="dataFormat" value="MESSAGE"/>
>             </cxf:properties>
>    </cxf:cxfEndpoint>
>
>    <cxf:cxfEndpoint id="servicio_web"
> address="
> http://192.168.0.128:8080/cnti_servicios/ServicioDirectorioEstadoVenezolano
> "
>         wsdlURL="ServicioDirectorioEstadoVenezolano.wsdl"
>         serviceName="cc:ServicioDirectorioEstadoVenezolano"
> endpointName="cc:ServicioDirectorioEstadoVenezolanoUbicacion">
>          <cxf:properties>
>                      <entry key="dataFormat" value="MESSAGE"/>
>              </cxf:properties>
>    </cxf:cxfEndpoint>
>
>    <camelContext id="converter"
> xmlns="http://camel.apache.org/schema/spring" >
>        <route streamCache="true">
>            <from uri="cxf:bean:servicio_web_bus" />
>            <to uri="cxf:bean:servicio_web" />
>        </route>
>    </camelContext>
>
> </beans>
>
> I hope for your response.
>
> Thank you
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5461039.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
-- 
*Charles Moulliard*
Sr. Principal Consultant  | *FuseSource Corp.*
cmoulliard@fusesource.com | fusesource.com
*mobile: *+32 473 604 014
skype: cmoulliard | twitter: @cmoulliard
blog:  cmoulliard.blogspot.com


 <http://www.progress.com/>