You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Angelo <an...@mckesson.com> on 2013/01/29 15:58:04 UTC

camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

I currently have an integration working in Tomcat - exposing services using
the camel-cxf endpoint e.g., cxf:/// - when deploying this to WebSphere I'm
running into some problems.  I've already set the classloader to local first
parent last.  There are still problems with conflicts for the rest of the
application - most of which stem from the servlet classes in the geronimo
jars. 

I am currently using Spring and the CXF Servlet set up in my web.xml which
works fine on Tomcat.  If I try to remove the geronimo and
cxf-rt-transport-http or cxf-rt-transport-http-jetty I get errors when camel
tries to parse and bind the endpoint - indicating that there's no available
type converter for the endpoint.

My questions are:

1) Am I using the correct approach to using camel-cxf endpoint in WebSphere?

2) How do I remove the dependencies on jetty and geronimo to avoid the
conflicts with the container libraries.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
Could you explain why the cxf.xml import is required given the technique(s)
I'm using to bootstrap these frameworks?

I will definitely try to remove the jetty dependency today - top priority
now that I got it working is to get rid of anything I don't absolutely need.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726555.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Willem jiang <wi...@gmail.com>.
I'm afraid you need to include the cxf.xml import this time.
BTW, you could exclude the dependency of cxf-rt-transport-http-jetty module, then the geronimo servlet api jar will be wrapped into the war.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Wednesday, January 30, 2013 at 10:39 AM, Angelo wrote:

> Our Maven war module pulls various domain-service catalog modules into the
> war. The war's web.xml (http://web.xml) has the CXFServlet configuration plus that web.xml (http://web.xml)
> also defines the spring context listener. Only the war module's application
> context contains the cxf.xml import (what I'm trying to jettison).
>  
> <listener>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener (http://web.context.ContextLoaderListener)</listener-class>
> </listener>
>  
>  
> <context-param>
> <param-name>contextConfigLocation</param-name>
>  
> <param-value>classpath*:*-applicationContext.xml,classpath*:pim-war-applicationContext-persistence.xml,classpath*:*applicationContext-common.xml</param-value>
> </context-param>
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726535.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
Our Maven war module pulls various domain-service catalog modules into the
war.  The war's web.xml has the CXFServlet configuration plus that web.xml
also defines the spring context listener.  Only the war module's application
context contains the cxf.xml import (what I'm trying to jettison).

<listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<context-param>
  <param-name>contextConfigLocation</param-name>
 
<param-value>classpath*:*-applicationContext.xml,classpath*:pim-war-applicationContext-persistence.xml,classpath*:*applicationContext-common.xml</param-value>
</context-param>



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726535.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Willem jiang <wi...@gmail.com>.
How did you load the camel context?
It looks like you just load the camel context from the CXF servlet.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, January 30, 2013 at 8:42 AM, Angelo wrote:

> Yeah, I just tried removing the cxf.xml import again and this is what I get.  
> As you can see - it's the CXFServlet that is expecting the registered bean.
>  
> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
> *No bean named 'cxf' is defined*
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1094)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
> at
> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)
> at
> *org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:77)*
> at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:71)
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726530.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
Yeah, I just tried removing the cxf.xml import again and this is what I get. 
As you can see - it's the CXFServlet that is expecting the registered bean.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
*No bean named 'cxf' is defined*
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1094)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
	at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)
	at
*org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:77)*
	at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:71)
	at
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726530.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
That's what I though too about needing the cxf.xml import - but when I
remove it I get into problems.  Not sure what's going on with that since I'm
using 2.7.0 as you can see.  But yeah that's kind of what's annoying me
because it looks like that's what's forcing the dependencies on the other
extensions. 

By the way - WAS 7.0.0.19 w/J9 64 1.6.0 jre

Anyway, it looks like I have it working now.  I didn't try this before
because I was following the instructions for WAS V7.  So I tried the WAS <
6.1.0.29 instructions here and so far looks like it works.  I set the server
and module class loaders back to parent first, then followed the
instructions for creating the shared library and referencing it in a new
classloader for the server set to local first.  In that shared classloader I
put only xmlschema-core-2.0.3.jar.  Like I said - so far so good, and
hopefully that's the only thing I need to do, then maybe I'll go back to
trying to jettison all the unnecessary libraries and that cxf.xml import. 

http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-ForWebSphere6.1.0.29%2CV7andV8

So according to you, the CXFServlet in the web.xml is enough to bootstrap
the cxf bus without that import - I'll do more investigating. 

Thanks for the input by the way - been stressing about this a lot the last
few days - it's a real deal breaker if we couldn't get it working.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726529.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 29, 2013 at 8:36 PM, Angelo <an...@mckesson.com> wrote:
>
> The problem is removing them and getting cxf to work right - I can't remove
> geronimo because cxf-http and cxf-http-jetty have deps on it and I can't
> remove those two because I get spring errors trying to load
> META-INF/cxf/cxf.xml using only the <import
> resource="classpath:META-INF/cxf/cxf.xml"/> in my context.
>

What version of Camel, CXF, WebSphere and JDK are you using?

In the newer versions of CXF you no longer need those imports in the
XML files anymore.

And there should be cxf-http-servlet you should use instead of
cxf-http-jetty. eg do NOT use -jetty JAR.
Use the cxf-http-servlet JAR instead.


> <http://camel.465427.n5.nabble.com/file/n5726517/deps.jpg>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726517.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Willem jiang <wi...@gmail.com>.
No, you don't need to use cxf-http-jetty module if you just want to the servlet transport.
CXF modules has no hard dependency of the geronimo servlet.
but CXF leverages the async invocation feature of servlet 3.0, you may need to check if the WebSphere supports it.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, January 30, 2013 at 3:36 AM, Angelo wrote:

>  
> The problem is removing them and getting cxf to work right - I can't remove
> geronimo because cxf-http and cxf-http-jetty have deps on it and I can't
> remove those two because I get spring errors trying to load
> META-INF/cxf/cxf.xml using only the <import
> resource="classpath:META-INF/cxf/cxf.xml"/> in my context.
>  
> <http://camel.465427.n5.nabble.com/file/n5726517/deps.jpg>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726517.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
The problem is removing them and getting cxf to work right - I can't remove
geronimo because cxf-http and cxf-http-jetty have deps on it and I can't
remove those two because I get spring errors trying to load
META-INF/cxf/cxf.xml using only the <import
resource="classpath:META-INF/cxf/cxf.xml"/> in my context.

<http://camel.465427.n5.nabble.com/file/n5726517/deps.jpg> 





--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726517.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
If I remove the serviceName and endpointName parameters to the cxf endpoint
and the previous errors are resolved but then it looks like it can't resolve
the service from the wsdl via servlce class - which is kind of what I
expected to happen.

// service class annotations
@WebServiceProvider(portName = "ptCreateContract", serviceName =
"CreateContractService", targetNamespace =
"http://mhs.mckesson.com/contracting/contract/ContractServiceV1")
@ServiceMode(Mode.PAYLOAD)

Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find definition for service
{http://mhs.mckesson.com/contracting/contract/ContractServiceV1}CreateContractService.
	at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:139)






--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726513.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 29, 2013 at 7:43 PM, Angelo <an...@mckesson.com> wrote:
> I already have the servlet working using this in my web.xml
>
> <servlet>
>   <servlet-name>CXFServlet</servlet-name>
>   <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>   <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
>   <servlet-name>CXFServlet</servlet-name>
>   <url-pattern>/webservices/*</url-pattern>
> </servlet-mapping>
>
> I can access the wsdl once it's up e.g.,
> http://localhost:8081/webservices/contracting?WSDL using this cxf endpoint
> in camel:
>
> cxf:///contracting?dataFormat=PAYLOAD&serviceName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}CreateContractService&endpointName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract&serviceClass=com.mckesson.mhs.integration.ws.contracting.ContractProvider&defaultOperationNamespace=http://mhs.mckesson.com/contracting/contract/ContractServiceV1&wsdlURL=classpath:com/mckesson/mhs/contracting/contract/ContractServiceV1.wsdl
>
>
> In WebSphere, the routes won't initialize unless I  have the geronimo
> servlet jars in the classpath - it gives me this error.  This strikes me as
> odd because it's almost like whatever is trying to resolve the endpoint in
> camel is not able to find the appropriate field to set the endpointName
> attribute.  I'm trying to remove the geronimo jars because they interfere
> with the websphere specific servlet/jsp libraries.
>

Yeah if you deploy as a WAR you should generally not have any servlet
APIs in the WEB-INF/lib dir.
But use what the container has out of the box.

There may be other APIs for other JEE services like Transaction etc
you should leave out as well
and use what the container offers.


>
> Caused by: org.apache.camel.spring.GenericBeansException: Error post
> processing bean: com.mckesson.mhs.integration.route.PIMCreateContractRoute;
> nested exception is org.apache.camel.ResolveEndpointFailedException: Failed
> to resolve endpoint:
> cxf:///contracting?dataFormat=PAYLOAD&serviceName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}CreateContractService&endpointName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract&serviceClass=com.mckesson.mhs.integration.ws.contracting.ContractProvider&defaultOperationNamespace=http://mhs.mckesson.com/contracting/contract/ContractServiceV1&wsdlURL=classpath:com/mckesson/mhs/contracting/contract/ContractServiceV1.wsdl
> due to: Could not find a suitable setter for property: endpointName as there
> isn't a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type: java.lang.String
> to the required type: javax.xml.namespace.QName with value
> {http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract
>         ... 47 more
> Caused by: java.lang.IllegalArgumentException: Could not find a suitable
> setter for property: endpointName as there isn't a setter method with same
> type: java.lang.String nor type conversion possible: No type converter
> available to convert from type: java.lang.String to the required type:
> javax.xml.namespace.QName with value
> {http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract
>         at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:347)
>         at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:367)
>         at
> org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:297)
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726508.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Angelo <an...@mckesson.com>.
I already have the servlet working using this in my web.xml

<servlet>
  <servlet-name>CXFServlet</servlet-name>
  <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>CXFServlet</servlet-name>
  <url-pattern>/webservices/*</url-pattern>
</servlet-mapping>

I can access the wsdl once it's up e.g.,
http://localhost:8081/webservices/contracting?WSDL using this cxf endpoint
in camel:

cxf:///contracting?dataFormat=PAYLOAD&serviceName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}CreateContractService&endpointName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract&serviceClass=com.mckesson.mhs.integration.ws.contracting.ContractProvider&defaultOperationNamespace=http://mhs.mckesson.com/contracting/contract/ContractServiceV1&wsdlURL=classpath:com/mckesson/mhs/contracting/contract/ContractServiceV1.wsdl


In WebSphere, the routes won't initialize unless I  have the geronimo
servlet jars in the classpath - it gives me this error.  This strikes me as
odd because it's almost like whatever is trying to resolve the endpoint in
camel is not able to find the appropriate field to set the endpointName
attribute.  I'm trying to remove the geronimo jars because they interfere
with the websphere specific servlet/jsp libraries.


Caused by: org.apache.camel.spring.GenericBeansException: Error post
processing bean: com.mckesson.mhs.integration.route.PIMCreateContractRoute;
nested exception is org.apache.camel.ResolveEndpointFailedException: Failed
to resolve endpoint:
cxf:///contracting?dataFormat=PAYLOAD&serviceName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}CreateContractService&endpointName=http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract&serviceClass=com.mckesson.mhs.integration.ws.contracting.ContractProvider&defaultOperationNamespace=http://mhs.mckesson.com/contracting/contract/ContractServiceV1&wsdlURL=classpath:com/mckesson/mhs/contracting/contract/ContractServiceV1.wsdl
due to: Could not find a suitable setter for property: endpointName as there
isn't a setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type: java.lang.String
to the required type: javax.xml.namespace.QName with value
{http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract
	... 47 more
Caused by: java.lang.IllegalArgumentException: Could not find a suitable
setter for property: endpointName as there isn't a setter method with same
type: java.lang.String nor type conversion possible: No type converter
available to convert from type: java.lang.String to the required type:
javax.xml.namespace.QName with value
{http://mhs.mckesson.com/contracting/contract/ContractServiceV1}ptCreateContract
	at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:347)
	at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:367)
	at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:297)





--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490p5726508.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cxf in WebSphere without geronimo/jetty depdendencies - possible

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

There is a cxf servlet component you should use.
Then it uses the servlet container as the http transport.

There should be some docs on CXF site about that.


On Tue, Jan 29, 2013 at 3:58 PM, Angelo <an...@mckesson.com> wrote:
>
> I currently have an integration working in Tomcat - exposing services using
> the camel-cxf endpoint e.g., cxf:/// - when deploying this to WebSphere I'm
> running into some problems.  I've already set the classloader to local first
> parent last.  There are still problems with conflicts for the rest of the
> application - most of which stem from the servlet classes in the geronimo
> jars.
>
> I am currently using Spring and the CXF Servlet set up in my web.xml which
> works fine on Tomcat.  If I try to remove the geronimo and
> cxf-rt-transport-http or cxf-rt-transport-http-jetty I get errors when camel
> tries to parse and bind the endpoint - indicating that there's no available
> type converter for the endpoint.
>
> My questions are:
>
> 1) Am I using the correct approach to using camel-cxf endpoint in WebSphere?
>
> 2) How do I remove the dependencies on jetty and geronimo to avoid the
> conflicts with the container libraries.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-in-WebSphere-without-geronimo-jetty-depdendencies-possible-tp5726490.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen