You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cvora <ch...@gmail.com> on 2010/06/14 16:04:29 UTC

JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Hi all

I'm trying to get the sample application from 
http://www.ibm.com/developerworks/java/library/j-jws13.html here  to work on
JBoss ESB 5.0.0RC1 with Apache CXF integration (jbossws-cxf-3.2.2.GA).  

I could get it to work using CXF servlet (after a few tweaks which took me
some time to figure out).

But when I try to use jbossws-cxf.xml to configure the webservice, I get the
error:

org.springframework.beans.TypeMismatchException: Failed to convert property
value of type [org.jboss.wsf.stack.cxf.InvokerJSE] to required type
[org.apache.cxf.service.invoker.Invoker] for property 'invoker'; nested
exception is java.lang.IllegalArgumentException: Cannot convert value of
type [org.jboss.wsf.stack.cxf.InvokerJSE] to required type
[org.apache.cxf.service.invoker.Invoker] for property 'invoker': no matching
editors or conversion strategy found

These are the changes I made to use the JBoss-CXF integration.

* removed cxf-servlet.xml from war WEB-INF and replaced with jbossws-cxf.xml

* changed web.xml to point to jbossws-cxf.xml thus

  <listener>
   
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/jbossws-cxf.xml</param-value>
  </context-param>


* commented out all references to CxfServlet from web.xml


Here is the jbossws-cxf.xml file:

<beans
  xmlns='http://www.springframework.org/schema/beans'
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
  xmlns:beans='http://www.springframework.org/schema/beans'
  xmlns:jaxws='http://cxf.apache.org/jaxws'
  xsi:schemaLocation='http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans.xsd
  http://cxf.apache.org/jaxws
  http://cxf.apache.org/schemas/jaxws.xsd'>

  <!-- one or more jaxws:endpoint POJO declarations -->
  <jaxws:endpoint
    id='Processor'
    address='http://localhost:8080/cxf-library-username'
    wsdlLocation="WEB-INF/wsdl/library-username.wsdl"
    implementor='com.sosnoski.ws.library.cxf.CXFLibraryImpl'>
      <jaxws:properties>
        <entry key="ws-security.callback-handler"
            value="com.sosnoski.ws.library.cxf.ServerCallback"/>
      </jaxws:properties>

    <jaxws:invoker>
      <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
    </jaxws:invoker>
  </jaxws:endpoint>

</beans>


Would appreciate any help as I can't figure out why this is not working.

Note: I also tried one other thing: I removed all the spring*.jar and
cxf*.jar from the lib directory of the war figuring the CXF layer should
take care of that. That resulted in a different error:
javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to
create service

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
java.lang.IllegalArgumentException: InputSource must have a ByteStream or
CharacterStream


Thanks in advance for any help!
CV

-- 
View this message in context: http://old.nabble.com/JBoss-CXF-integration-%3A-org.springframework.beans.TypeMismatchException-in-sample-webservice-tp28879980p28879980.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by Alessio Soldano <as...@redhat.com>.
Hi,
this is something that should really go to jboss forums, needless to 
bother the CXF community, so please see if you can post there.
In any case, can you check your pojo is correctly jaxws annotated? It 
does not seem to be recognized as ws endpoint.

Alessio

cvora wrote:
> Alessio
>
> Got a ClassCastException when I tried that (btw, there is a typo in my
> earlier post - the impl POJO is CXFLibraryImpl and the Library is the
> interface, I adjusted web.xml accordingly)
>  
> Error:
> java.lang.ClassCastException: com.sosnoski.ws.library.cxf.CXFLibraryImpl
> cannot be cast to javax.servlet.Servlet
>
> 	at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
> 	at
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
> 	at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
> 	at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
> 	at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:619)
>
> Any ideas? 
>
> Note: I didn't try with 3.3.1 GA yet because my JBoss AS version is 5.0.0
> and the ant.properties file for 3.3.1GA didn't mention it works with 5.0.0. 
>
> CV
>
>
>
> Alessio Soldano wrote:
>   
>> Yes, where com.sosnoski.ws.library.cxf.Library is your pojo. That's 
>> basically the way pojo ws endpoins are declared in JBossWS: 
>> http://community.jboss.org/wiki/JBossWS-UserGuide#Plain_old_Java_Object_POJO
>> The web.xml is used for creating the actual web app that later uses 
>> Apache CXF.
>>
>> Cheers
>> Alessio
>>
>> -- 
>> Alessio Soldano
>> Web Service Lead, JBoss
>>
>>
>>
>>     
>
>   


-- 
Alessio Soldano
Web Service Lead, JBoss


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by cvora <ch...@gmail.com>.
Alessio

Got a ClassCastException when I tried that (btw, there is a typo in my
earlier post - the impl POJO is CXFLibraryImpl and the Library is the
interface, I adjusted web.xml accordingly)
 
Error:
java.lang.ClassCastException: com.sosnoski.ws.library.cxf.CXFLibraryImpl
cannot be cast to javax.servlet.Servlet

	at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
	at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
	at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
	at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)

Any ideas? 

Note: I didn't try with 3.3.1 GA yet because my JBoss AS version is 5.0.0
and the ant.properties file for 3.3.1GA didn't mention it works with 5.0.0. 

CV



Alessio Soldano wrote:
> 
> Yes, where com.sosnoski.ws.library.cxf.Library is your pojo. That's 
> basically the way pojo ws endpoins are declared in JBossWS: 
> http://community.jboss.org/wiki/JBossWS-UserGuide#Plain_old_Java_Object_POJO
> The web.xml is used for creating the actual web app that later uses 
> Apache CXF.
> 
> Cheers
> Alessio
> 
> -- 
> Alessio Soldano
> Web Service Lead, JBoss
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JBoss-CXF-integration-%3A-org.springframework.beans.TypeMismatchException-in-sample-webservice-tp28879980p28881640.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by Alessio Soldano <as...@redhat.com>.
cvora wrote:
> Thanks Alessio for your response.
>
> So if I remove the Context listener from web.xml, what should my web.xml
> have? Please note that my webservice Impl is a pojo, not a servlet.
>
> Based on the testcase for username
> (modules\testsuite\cxf-tests\src\test\resources\jaxws\samples\wsse\username),
> it seems like I need to have something like this in the web.xml:
>
>    <servlet>
>       <servlet-name>Library Service</servlet-name>
>       <servlet-class>com.sosnoski.ws.library.cxf.Library</servlet-class>
>    </servlet>
>    <servlet-mapping>
>       <servlet-name>Library Service</servlet-name>
>       <url-pattern>/*</url-pattern>
>    </servlet-mapping>
>
> Am I on the right path here?
>   
Yes, where com.sosnoski.ws.library.cxf.Library is your pojo. That's 
basically the way pojo ws endpoins are declared in JBossWS: 
http://community.jboss.org/wiki/JBossWS-UserGuide#Plain_old_Java_Object_POJO
The web.xml is used for creating the actual web app that later uses 
Apache CXF.

Cheers
Alessio

-- 
Alessio Soldano
Web Service Lead, JBoss


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by cvora <ch...@gmail.com>.
Thanks Alessio for your response.

So if I remove the Context listener from web.xml, what should my web.xml
have? Please note that my webservice Impl is a pojo, not a servlet.

Based on the testcase for username
(modules\testsuite\cxf-tests\src\test\resources\jaxws\samples\wsse\username),
it seems like I need to have something like this in the web.xml:

   <servlet>
      <servlet-name>Library Service</servlet-name>
      <servlet-class>com.sosnoski.ws.library.cxf.Library</servlet-class>
   </servlet>
   <servlet-mapping>
      <servlet-name>Library Service</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

Am I on the right path here?


Alessio Soldano wrote:
> 
> Hi,
> <snip>
> 
> 

-- 
View this message in context: http://old.nabble.com/JBoss-CXF-integration-%3A-org.springframework.beans.TypeMismatchException-in-sample-webservice-tp28879980p28880911.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by Alessio Soldano <as...@redhat.com>.
Hi,
few general suggestions, this does not seems a CXF issue at all, just a 
matter of proper integration configuration:
- move to the latest available jbossws-cxf version (3.3.1.GA), also 
considering that has the latest fix/improvements released with Apache 
CXF 2.2.9
- yes, you're right in removing the cxf-*.jar from your deployment if 
jbossws-cxf stack is installed in JBoss AS
- you do not need to provide any context listener configuration pointing 
to jbossws-cxf.xml, the integration layer automatically scans for 
jbossws-cxf.xml if available and uses that to enrich the cxf bus
- take a look at the testcases in the jbossws-cxf source distribution

Cheers
Alessio

cvora wrote:
> Hi all
>
> I'm trying to get the sample application from 
> http://www.ibm.com/developerworks/java/library/j-jws13.html here  to work on
> JBoss ESB 5.0.0RC1 with Apache CXF integration (jbossws-cxf-3.2.2.GA).  
>
> I could get it to work using CXF servlet (after a few tweaks which took me
> some time to figure out).
>
> But when I try to use jbossws-cxf.xml to configure the webservice, I get the
> error:
>
> org.springframework.beans.TypeMismatchException: Failed to convert property
> value of type [org.jboss.wsf.stack.cxf.InvokerJSE] to required type
> [org.apache.cxf.service.invoker.Invoker] for property 'invoker'; nested
> exception is java.lang.IllegalArgumentException: Cannot convert value of
> type [org.jboss.wsf.stack.cxf.InvokerJSE] to required type
> [org.apache.cxf.service.invoker.Invoker] for property 'invoker': no matching
> editors or conversion strategy found
>
> These are the changes I made to use the JBoss-CXF integration.
>
> * removed cxf-servlet.xml from war WEB-INF and replaced with jbossws-cxf.xml
>
> * changed web.xml to point to jbossws-cxf.xml thus
>
>   <listener>
>    
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>   </listener>
>   <context-param>
>     <param-name>contextConfigLocation</param-name>
>     <param-value>WEB-INF/jbossws-cxf.xml</param-value>
>   </context-param>
>
>
> * commented out all references to CxfServlet from web.xml
>
>
> Here is the jbossws-cxf.xml file:
>
> <beans
>   xmlns='http://www.springframework.org/schema/beans'
>   xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
>   xmlns:beans='http://www.springframework.org/schema/beans'
>   xmlns:jaxws='http://cxf.apache.org/jaxws'
>   xsi:schemaLocation='http://www.springframework.org/schema/beans
>   http://www.springframework.org/schema/beans/spring-beans.xsd
>   http://cxf.apache.org/jaxws
>   http://cxf.apache.org/schemas/jaxws.xsd'>
>
>   <!-- one or more jaxws:endpoint POJO declarations -->
>   <jaxws:endpoint
>     id='Processor'
>     address='http://localhost:8080/cxf-library-username'
>     wsdlLocation="WEB-INF/wsdl/library-username.wsdl"
>     implementor='com.sosnoski.ws.library.cxf.CXFLibraryImpl'>
>       <jaxws:properties>
>         <entry key="ws-security.callback-handler"
>             value="com.sosnoski.ws.library.cxf.ServerCallback"/>
>       </jaxws:properties>
>
>     <jaxws:invoker>
>       <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
>     </jaxws:invoker>
>   </jaxws:endpoint>
>
> </beans>
>
>
> Would appreciate any help as I can't figure out why this is not working.
>
> Note: I also tried one other thing: I removed all the spring*.jar and
> cxf*.jar from the lib directory of the war figuring the CXF layer should
> take care of that. That resulted in a different error:
> javax.xml.ws.WebServiceException:
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to
> create service
>
> Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
> java.lang.IllegalArgumentException: InputSource must have a ByteStream or
> CharacterStream
>
>
> Thanks in advance for any help!
> CV
>
>   


-- 
Alessio Soldano
Web Service Lead, JBoss


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by Mariusz Brylant <mb...@gmail.com>.
This works for me with spring and latest cxf under jboss 4.3 EAP:


applicationContext.xml:
....
 <jaxws:server 
      id="tmfService" 
      start="true"
      serviceClass="com.bskyb.tmf.services.core.TmfCorePort"
      serviceBean="#tmfBean"
      serviceName="tmf-services-core:estaskService"
      transportId=""
      address="/estask"
      xmlns:tmf-services-core="http://tmf.bskyb.com/services/core"
      wsdlLocation="classpath:estask.wsdl"
      bus="cxf">
       <jaxws:properties>
			 <entry key="schema-validation-enabled" value="true"/>
		</jaxws:properties>
      </jaxws:server>
...

web.xml:

  <listener>
       
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
      			/WEB-INF/applicationContext.xml
      </param-value>
</context-param>
  	<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>/*</url-pattern>
	</servlet-mapping>
....

However, If you deploy your own libraries to jboss, they are likely to be
conflicting with those already bundled. Which is a case with cxf. You need
properly isolate classloader of your application form the jboss system one. 


cvora wrote:
> 
> Hi all
> 
> I'm trying to get the sample application from 
> http://www.ibm.com/developerworks/java/library/j-jws13.html here  to work
> on JBoss ESB 5.0.0RC1 with Apache CXF integration (jbossws-cxf-3.2.2.GA).  
> 
> I could get it to work using CXF servlet (after a few tweaks which took me
> some time to figure out).
> 
> But when I try to use jbossws-cxf.xml to configure the webservice, I get
> the error:
> 
> org.springframework.beans.TypeMismatchException: Failed to convert
> property value of type [org.jboss.wsf.stack.cxf.InvokerJSE] to required
> type [org.apache.cxf.service.invoker.Invoker] for property 'invoker';
> nested exception is java.lang.IllegalArgumentException: Cannot convert
> value of type [org.jboss.wsf.stack.cxf.InvokerJSE] to required type
> [org.apache.cxf.service.invoker.Invoker] for property 'invoker': no
> matching editors or conversion strategy found
> 
> These are the changes I made to use the JBoss-CXF integration.
> 
> * removed cxf-servlet.xml from war WEB-INF and replaced with
> jbossws-cxf.xml
> 
> * changed web.xml to point to jbossws-cxf.xml thus
> 
>   <listener>
>    
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>   </listener>
>   <context-param>
>     <param-name>contextConfigLocation</param-name>
>     <param-value>WEB-INF/jbossws-cxf.xml</param-value>
>   </context-param>
> 
> 
> * commented out all references to CxfServlet from web.xml
> 
> 
> Here is the jbossws-cxf.xml file:
> 
> <beans
>   xmlns='http://www.springframework.org/schema/beans'
>   xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
>   xmlns:beans='http://www.springframework.org/schema/beans'
>   xmlns:jaxws='http://cxf.apache.org/jaxws'
>   xsi:schemaLocation='http://www.springframework.org/schema/beans
>   http://www.springframework.org/schema/beans/spring-beans.xsd
>   http://cxf.apache.org/jaxws
>   http://cxf.apache.org/schemas/jaxws.xsd'>
> 
>   <!-- one or more jaxws:endpoint POJO declarations -->
>   <jaxws:endpoint
>     id='Processor'
>     address='http://localhost:8080/cxf-library-username'
>     wsdlLocation="WEB-INF/wsdl/library-username.wsdl"
>     implementor='com.sosnoski.ws.library.cxf.CXFLibraryImpl'>
>       <jaxws:properties>
>         <entry key="ws-security.callback-handler"
>             value="com.sosnoski.ws.library.cxf.ServerCallback"/>
>       </jaxws:properties>
> 
>     <jaxws:invoker>
>       <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
>     </jaxws:invoker>
>   </jaxws:endpoint>
> 
> </beans>
> 
> 
> Would appreciate any help as I can't figure out why this is not working.
> 
> Note: I also tried one other thing: I removed all the spring*.jar and
> cxf*.jar from the lib directory of the war figuring the CXF layer should
> take care of that. That resulted in a different error:
> javax.xml.ws.WebServiceException:
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to
> create service
> 
> Caused by: javax.wsdl.WSDLException: WSDLException:
> faultCode=PARSER_ERROR: java.lang.IllegalArgumentException: InputSource
> must have a ByteStream or CharacterStream
> 
> 
> Thanks in advance for any help!
> CV
> 
> 

-- 
View this message in context: http://old.nabble.com/JBoss-CXF-integration-%3A-org.springframework.beans.TypeMismatchException-in-sample-webservice-tp28879980p28887053.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JBoss CXF integration : org.springframework.beans.TypeMismatchException in sample webservice

Posted by cvora <ch...@gmail.com>.
By the way, I'm trying to post to the JBoss Community forum for CXF but their
site registration is down and I've forgotten my password (its been a while
:-( ). I figured there might be some folks here who might have some insight
so posting here.

Thanks!

-- 
View this message in context: http://old.nabble.com/JBoss-CXF-integration-%3A-org.springframework.beans.TypeMismatchException-in-sample-webservice-tp28879980p28880011.html
Sent from the cxf-user mailing list archive at Nabble.com.