Jersey-client kullanılan bir projede über jar (fat jar) yarattığınızda soruna yol açabilmektedir. Uber jar yaratmak için genellikle Maven'da maven-shade-plugin kullanılır :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>junit:junit</exclude>
<exclude>jmock:*</exclude>
<exclude>*:xml-apis</exclude>
<exclude>org.apache.maven:lib:tests</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
Bu plugin ile ürettiğiniz jar'ı kullanarak çalıştırdığınızda aşağıdaki hata alınabilir:
org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/json, type=class [com.fibiler.Test;, genericType=class [Lcom.fibiler.Test
Bunun sebebi maven-shade-plugin, jersey ile ilişkili jar'lardaki META-INF içindeki services klasöründeki tanımları birleştirmemesidir. Bunu çözmek için ServicesResourceTransformer kullanılır. Bu eklediğinde maven-shade-plugin şu hale döner :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>junit:junit</exclude>
<exclude>jmock:*</exclude>
<exclude>*:xml-apis</exclude>
<exclude>org.apache.maven:lib:tests</exclude>
</excludes>
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Bu şekilde über jar ürettiğinizde hata düzelmiş olması gerekir.