You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by sonia ayadi <so...@hotmail.fr> on 2011/05/26 11:34:33 UTC

Problem using CXF

Hi,

 

When I
generate the code Java from a WSDL I had an ERROR using CXF :

 

java.lang.IllegalArgumentException:
An operation with name [{http://BounceWS/}AssignEpop] already exists in this
service

 

I solved
this problem by commenting one of method with the same name in the WSDL file :

 

<wsdl:operation
name="AssignEpop">     
<wsdl:input name="AssignEpopMethod1"
message="tns:AssignEpopMethod1SoapIn" />     
<wsdl:output name="AssignEpopMethod1"
message="tns:AssignEpopMethod1SoapOut" />   
</wsdl:operation>  
<!-- <wsdl:operation name="AssignEpop">     
<wsdl:input name="AssignEpopMethod2"
message="tns:AssignEpopMethod2SoapIn" />     
<wsdl:output name="AssignEpopMethod2"
message="tns:AssignEpopMethod2SoapOut" />   
</wsdl:operation>-->     
<wsdl:operation name="AssignEpop">     
<soap:operation soapAction="http://BounceWS/AssignEpopMethod1"
style="document" />   
  <wsdl:input name="AssignEpopMethod1">       
<soap:body use="literal" />     
</wsdl:input>     
<wsdl:output name="AssignEpopMethod1">       
<soap:body use="literal" />     
</wsdl:output>   
</wsdl:operation>   
<!--<wsdl:operation name="AssignEpop">     
<soap:operation soapAction="http://BounceWS/AssignEpopMethod2"
style="document" />     
<wsdl:input name="AssignEpopMethod2">       
<soap:body use="literal" />     
</wsdl:input>     
<wsdl:output name="AssignEpopMethod2">       
<soap:body use="literal" />     
</wsdl:output>   
</wsdl:operation>-->























































 

Now, I have
a problem when I run my program: 

 

Exception in
thread "Thread-63" java.lang.LinkageError: loader constraint
violation: when resolving method "com.sun.xml.bind.v2.runtime.MarshallerImpl.setEventHandler(Ljavax/xml/bind/ValidationEventHandler;)V"
the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader)
of the current class, com/sun/xml/bind/v2/runtime/MarshallerImpl, and the class
loader (instance of
<bootloader>) for resolved class,
com/sun/xml/bind/v2/runtime/MarshallerImpl, have different Class objects for
the type javax/xml/bind/ValidationEventHandler
used in the signature       
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.<init>(MarshallerImpl.java:154)       
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:734)       
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:138)       
at
org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:102)       
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)       
at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:105)       
at
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)       
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)       
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)       
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308)       
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:260)       
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)       
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)       
at $Proxy43.dbConnectionOK(Unknown Source)       
at
com.orange.m2m.smartbuilding.businessappli.drivers.impl.bounce.DriverBounce.startDriver(DriverBounce.java:204)       
at
com.orange.m2m.smartbuilding.businessappli.drivers.impl.bounce.DriverBounce.getDriver(DriverBounce.java:143)       
at com.orange.m2m.smartbuilding.businessappli.adapters.impl.bouncews.AdapterBounceWS.adapterStarting(AdapterBounceWS.java:254)        at
com.orange.m2m.smartbuilding.core.adapters.Adapter.startAdapter(Adapter.java:207)        at com.orange.m2m.smartbuilding.core.controllers.Controller.componentStarting(Controller.java:458)       
at
com.orange.m2m.smartbuilding.core.components.Component.startComponent(Component.java:542)       
at com.orange.m2m.smartbuilding.core.starters.impl.GenericStarterImpl.startComponent(GenericStarterImpl.java:325)       
at
com.orange.m2m.smartbuilding.core.starters.impl.GenericStarterImpl.buildController(GenericStarterImpl.java:116)       
at
com.orange.m2m.smartbuilding.businessappli.starters.impl.bounce.StarterBounce.buildBounce(StarterBounce.java:129)       
at
com.orange.m2m.smartbuilding.businessappli.starters.impl.bounce.StarterBounce.timeOut(StarterBounce.java:145)       
at com.orange.m2m.smartbuilding.core.utils.Timer$1.run(Timer.java:127)





























































 

Can you
help me to locate the problem?

 

Thanks.

Sonia. 		 	   		  

Re: Problem using CXF

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

Seems you're using cxf in OSGi container, right?
If so, could you elaborate what's OSGi container you're using and how  
you use cxf in it?
The LinkageError should come from you load jaxb api from different  
classloader, or there's two copys of jaxb api in your OSGi container.
Generally when run cxf with OSGi container we should  comment out  
javax.xml.bind* package from jdk and use jaxb-api bundle.
I suggest you use Apache Servicemix4 as the OSGi container, which  
support run cxf out of the box and have a set of examples, so that you  
needn't take care of the underlying details.

Freeman



On 2011-5-26, at 下午5:34, sonia ayadi wrote:

>
> Hi,
>
>
>
> When I
> generate the code Java from a WSDL I had an ERROR using CXF :
>
>
>
> java.lang.IllegalArgumentException:
> An operation with name [{http://BounceWS/}AssignEpop] already exists  
> in this
> service
>
>
>
> I solved
> this problem by commenting one of method with the same name in the  
> WSDL file :
>
>
>
> <wsdl:operation
> name="AssignEpop">
> <wsdl:input name="AssignEpopMethod1"
> message="tns:AssignEpopMethod1SoapIn" />
> <wsdl:output name="AssignEpopMethod1"
> message="tns:AssignEpopMethod1SoapOut" />
> </wsdl:operation>
> <!-- <wsdl:operation name="AssignEpop">
> <wsdl:input name="AssignEpopMethod2"
> message="tns:AssignEpopMethod2SoapIn" />
> <wsdl:output name="AssignEpopMethod2"
> message="tns:AssignEpopMethod2SoapOut" />
> </wsdl:operation>-->
> <wsdl:operation name="AssignEpop">
> <soap:operation soapAction="http://BounceWS/AssignEpopMethod1"
> style="document" />
>  <wsdl:input name="AssignEpopMethod1">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="AssignEpopMethod1">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> <!--<wsdl:operation name="AssignEpop">
> <soap:operation soapAction="http://BounceWS/AssignEpopMethod2"
> style="document" />
> <wsdl:input name="AssignEpopMethod2">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="AssignEpopMethod2">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>-->
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Now, I have
> a problem when I run my program:
>
>
>
> Exception in
> thread "Thread-63" java.lang.LinkageError: loader constraint
> violation: when resolving method  
> "com.sun.xml.bind.v2.runtime.MarshallerImpl.setEventHandler(Ljavax/ 
> xml/bind/ValidationEventHandler;)V"
> the class loader (instance of org/apache/felix/framework/ModuleImpl 
> $ModuleClassLoader)
> of the current class, com/sun/xml/bind/v2/runtime/MarshallerImpl,  
> and the class
> loader (instance of
> <bootloader>) for resolved class,
> com/sun/xml/bind/v2/runtime/MarshallerImpl, have different Class  
> objects for
> the type javax/xml/bind/ValidationEventHandler
> used in the signature
> at
> com 
> .sun.xml.bind.v2.runtime.MarshallerImpl.<init>(MarshallerImpl.java: 
> 154)
> at
> com 
> .sun 
> .xml 
> .bind 
> .v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:734)
> at  
> com 
> .sun 
> .xml 
> .bind 
> .v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:138)
> at
> org 
> .apache 
> .cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:102)
> at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java: 
> 169)
> at
> org 
> .apache 
> .cxf 
> .interceptor 
> .AbstractOutDatabindingInterceptor 
> .writeParts(AbstractOutDatabindingInterceptor.java:105)
> at
> org 
> .apache 
> .cxf 
> .interceptor 
> .BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
> at  
> org 
> .apache 
> .cxf 
> .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 
> 236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:260)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at  
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java: 
> 124)
> at $Proxy43.dbConnectionOK(Unknown Source)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .businessappli 
> .drivers.impl.bounce.DriverBounce.startDriver(DriverBounce.java:204)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .businessappli 
> .drivers.impl.bounce.DriverBounce.getDriver(DriverBounce.java:143)
> at  
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .businessappli 
> .adapters 
> .impl.bouncews.AdapterBounceWS.adapterStarting(AdapterBounceWS.java: 
> 254)        at
> com 
> .orange 
> .m2m.smartbuilding.core.adapters.Adapter.startAdapter(Adapter.java: 
> 207)        at  
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .core.controllers.Controller.componentStarting(Controller.java:458)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .core.components.Component.startComponent(Component.java:542)
> at  
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .core 
> .starters 
> .impl.GenericStarterImpl.startComponent(GenericStarterImpl.java:325)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .core 
> .starters 
> .impl.GenericStarterImpl.buildController(GenericStarterImpl.java:116)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .businessappli 
> .starters.impl.bounce.StarterBounce.buildBounce(StarterBounce.java: 
> 129)
> at
> com 
> .orange 
> .m2m 
> .smartbuilding 
> .businessappli 
> .starters.impl.bounce.StarterBounce.timeOut(StarterBounce.java:145)
> at com.orange.m2m.smartbuilding.core.utils.Timer$1.run(Timer.java:127)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Can you
> help me to locate the problem?
>
>
>
> Thanks.
>
> Sonia. 		 	   		

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference









Re: Problem using CXF

Posted by fradj zayen <za...@gmail.com>.
Hi sonia,
generally the  java.lang.LinkageError occurs when you use different version
of JVM.
for example if you are using jdk1.6  for the compilation and you run run
you your application using 1.5, this error may occur





2011/5/26 sonia ayadi <so...@hotmail.fr>

>
> Hi,
>
>
>
> When I
> generate the code Java from a WSDL I had an ERROR using CXF :
>
>
>
> java.lang.IllegalArgumentException:
> An operation with name [{http://BounceWS/}AssignEpop<http://bouncews/%7DAssignEpop>]
> already exists in this
> service
>
>
>
> I solved
> this problem by commenting one of method with the same name in the WSDL
> file :
>
>
>
> <wsdl:operation
> name="AssignEpop">
> <wsdl:input name="AssignEpopMethod1"
> message="tns:AssignEpopMethod1SoapIn" />
> <wsdl:output name="AssignEpopMethod1"
> message="tns:AssignEpopMethod1SoapOut" />
> </wsdl:operation>
> <!-- <wsdl:operation name="AssignEpop">
> <wsdl:input name="AssignEpopMethod2"
> message="tns:AssignEpopMethod2SoapIn" />
> <wsdl:output name="AssignEpopMethod2"
> message="tns:AssignEpopMethod2SoapOut" />
> </wsdl:operation>-->
> <wsdl:operation name="AssignEpop">
> <soap:operation soapAction="http://BounceWS/AssignEpopMethod1<http://bouncews/AssignEpopMethod1>
> "
> style="document" />
>  <wsdl:input name="AssignEpopMethod1">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="AssignEpopMethod1">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> <!--<wsdl:operation name="AssignEpop">
> <soap:operation soapAction="http://BounceWS/AssignEpopMethod2<http://bouncews/AssignEpopMethod2>
> "
> style="document" />
> <wsdl:input name="AssignEpopMethod2">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="AssignEpopMethod2">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>-->
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Now, I have
> a problem when I run my program:
>
>
>
> Exception in
> thread "Thread-63" java.lang.LinkageError: loader constraint
> violation: when resolving method
> "com.sun.xml.bind.v2.runtime.MarshallerImpl.setEventHandler(Ljavax/xml/bind/ValidationEventHandler;)V"
> the class loader (instance of
> org/apache/felix/framework/ModuleImpl$ModuleClassLoader)
> of the current class, com/sun/xml/bind/v2/runtime/MarshallerImpl, and the
> class
> loader (instance of
> <bootloader>) for resolved class,
> com/sun/xml/bind/v2/runtime/MarshallerImpl, have different Class objects
> for
> the type javax/xml/bind/ValidationEventHandler
> used in the signature
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.<init>(MarshallerImpl.java:154)
> at
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:734)
> at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:138)
> at
>
> org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:102)
> at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
> at
>
> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:105)
> at
>
> org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:260)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy43.dbConnectionOK(Unknown Source)
> at
>
> com.orange.m2m.smartbuilding.businessappli.drivers.impl.bounce.DriverBounce.startDriver(DriverBounce.java:204)
> at
>
> com.orange.m2m.smartbuilding.businessappli.drivers.impl.bounce.DriverBounce.getDriver(DriverBounce.java:143)
> at
> com.orange.m2m.smartbuilding.businessappli.adapters.impl.bouncews.AdapterBounceWS.adapterStarting(AdapterBounceWS.java:254)
>        at
> com.orange.m2m.smartbuilding.core.adapters.Adapter.startAdapter(Adapter.java:207)
>        at
> com.orange.m2m.smartbuilding.core.controllers.Controller.componentStarting(Controller.java:458)
> at
>
> com.orange.m2m.smartbuilding.core.components.Component.startComponent(Component.java:542)
> at
> com.orange.m2m.smartbuilding.core.starters.impl.GenericStarterImpl.startComponent(GenericStarterImpl.java:325)
> at
>
> com.orange.m2m.smartbuilding.core.starters.impl.GenericStarterImpl.buildController(GenericStarterImpl.java:116)
> at
>
> com.orange.m2m.smartbuilding.businessappli.starters.impl.bounce.StarterBounce.buildBounce(StarterBounce.java:129)
> at
>
> com.orange.m2m.smartbuilding.businessappli.starters.impl.bounce.StarterBounce.timeOut(StarterBounce.java:145)
> at com.orange.m2m.smartbuilding.core.utils.Timer$1.run(Timer.java:127)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Can you
> help me to locate the problem?
>
>
>
> Thanks.
>
> Sonia.