Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError:org.apache.cxf.service.model.MessageInfo.getFirstMessagePart() org/apache/cxf/service/model/MessagePartInfo;

Tags:

spring

maven

cxf

cxf-api-2.7.18 - org.apache.cxf.service.model.MessageInfo
cxf-core-3.1.11 - org.apache.cxf.service.model.MessageInfo

Both the jars have same class and same package structure.

I am getting

java.lang.NoSuchMethodError:
    org.apache.cxf.service.model.MessageInfo.getFirstMessagePart()
    org/apache/cxf/service/model/MessagePartInfo;

getFirstMessagePart() method is available in cxf-core-3.1.11 jar. I have generated the war using Apache Maven 3.3.9 version and deployed it in tomcat server 8. At runtime, looking for the getFirstMessagePart() in cxf-api-2.7.18 which is not available. Seems like I have to give cxf-core-3.1.11 jar preference first. How should I do that? Could anyone help me on this?

I am using Java 8 and spring 4.1.7.release

like image 626
Karthick Avatar asked Nov 20 '25 01:11

Karthick


1 Answers

Since Apache CXF 3.0 release, core and api module are on the same distribution (cxf-core).

To your problem, you should exclude cxf-api-2.x from your project and use only cxf-core-3.x

Source: Apache CXF 3.0 migration guide

like image 83
Tiago Mussi Avatar answered Nov 22 '25 05:11

Tiago Mussi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!