How to solve NoSuchMethodError when i'm calling webservice from workflow?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hello, 

i'm trying upload file through webservice client but i m getting this error:

Caused by: java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/StringSmiley WinkLorg/apache/ws/
commons/schema/XmlSchema;
at org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:133)
at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:192)
at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:95)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:380)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:474)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:685)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:536)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:248)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:156)
at sk.iway.dms3.UploadUnsignedServiceMain.uploadUnsigned(UploadUnsignedServiceMain.java:141)
at sk.iway.dms3.UploadUnsignedServiceMain.runme(UploadUnsignedServiceMain.java:83)
at com.iway.Test.execute(Test.java:78)

I suspect that there is conflict between org.apache.commons.schema.XmlSchema that is include in alfresco-repository:5.1.e.jar and org.apache.ws.xmlschema.xmlschema-core which i'm using in my webservice client.

Could you give me some advices how to solve this problem. If i run the client it works. but if i call client from workflow service task, i'm getting NoSuchMethodError. 

Thank you so much for any help.

Jakub

13 Replies
Highlighted
Established Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi  ,

Apparently there's a conflict of library versions and some method cannot be found in the classpath. Are you able to make sure that you're using the same version of the library in your client? 

Thanks,

Thong Huynh

Highlighted
Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi

Thank you for your answer, yep i'm sure the versions from client are the same. Last time i ve tried to use activiti-cxf 5.20.0 instead of just org.apache.cxf but i still get the same error. Any ideas what may cause the conflict?

Thank you

Jakub Rautner

Highlighted
Established Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

HI  ,

I would need to reproduce this in a very simple unit test to answer you. Would you mind describing your implementation scenario/use case? The best is you can send over a unit test.

Thanks,

Thong

Highlighted
Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi Thong Huynh

It's very simple use case. I'm trying to call webservice from workflow. There is one userTask and one serviceTask in workflow. Service task is calling java class where is implemented call to our webservice. When I'm trying call webservice from some main class just like a java class its work. When i try to call ws from service Task i get  this error. I try to solve it just localy with embedded tomcat server from alfresco-sdk-parent. Alfresco version is 5.1.e, activiti-cxf version 5.19.0.1 and org.apache.httpcomponents.httpcore version 4.4.5, those are external libraries i'm using.

Is it enough to test it for you?

Thank you for your answer

Jakub Rautner

Highlighted
Established Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi Jakub Rautner 

Thanks for the details but I'm afraid I would need to see your implementation to answer you why your code isn't working. It could be anything. Without a unit test to demonstrate the issue, I won't be able to answer you why.

I ran a quick unit test to test calling a web service (SOAP) from the Java Service Task and it works as expected. I have attached my unit test log and the process def xml. As you can see in the log, I was able to successfully call the public web service and get back the response. 

There are many ways you can call web service from Java Service Task. My unit test uses this library Maven Repository: javax.xml.soap » saaj-api » 1.3.5 

Please spend time to write up a unit test that shows your issue and share. That's the most effective way for people to understand your issue and help you.

Thanks,

Thong

Highlighted
Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi

thank you for your example it works fine for me. So there is probably problem with our webservice. Is there any clue how to proceed with creating webservice used in alfresco? Unit test is still needed for you?

Thanks Jakub

Highlighted
Established Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi  ,

Test your web service using your browser to see if it works. No unit test is needed for that. 

Thanks,

Thong

Highlighted
Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi Thong Huynh,

Sorry I wasn't specific. Our webservice works, if im try it in browser or if i'm calling ws from console with client. But in alfresco context it does not work. There is problem with javax.xml.ws.Service class. In our ws classloader takes it from default jdk but in alfresco context it takes this class from geronimo-jaxws_2.1_spec-1.0.jar 

Thank you for any advices.

Jakub

Highlighted
Established Member II

Re: How to solve NoSuchMethodError when i'm calling webservice from workflow?

Hi  

By

alfresco context

Are you referring to Alfresco ECM or Alfresco BPM (Activiti) ?

Thanks

Thong