I have written an API Man plugin which uses com.squareup.okhttp3:okhttp:3.11.0 as a dependency, this has a transient dependency on com.squareup.okio:okio:jar:1.14.0. However it appears Wildfly (10.1.0.Final) is using a different version off this com.squareup.okio:okio:jar:1.4.0, as a result I am getting the following exception.
java.lang.NoSuchMethodError: okio.BufferedSource.readUtf8LineStrict(J)Ljava/lang/String;
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:215)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
To try and get around this I have included the following jboss-deployment-structure.xml in my projects src/main/webapp/WEB-INF directory
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding
some dependencies -->
<exclusions>
<module name="okio" />
</exclusions>
</deployment>
</jboss-deployment-structure>
It doesn't seem to have resolved it however
To avoid dependency load from wildly you need to add an exclusion. The exclusion you added is incorrect
Also if you are using classes related to above dependency in your code then provide these jar files externally in your classpath/lib folder of deployable. Add below two jars in your lib folder.