2016-11-03 3 views
0

Ich ändere Muster "com.sun.jersey" zu shadedPattern "route66.com.sun.jersey" mit maven shade plugin.Jersey-Probleme mit Maven-Schattierung: Schattierungsmuster com.sun.jersey wirft Laufzeitfehler "MultiPartReaderClientSide, konnte nicht instanziiert werden"

Ich benutze com.sun.jersey: jersey-client: 1.19.3 in meinem code und lauf es auf hadoop. Aber hadoop system lib jars haben eine ältere Version von jersey-client. Also musste ich das Muster "com.sun.jersey" in shadedPattern "route66.com.sun.jersey" ändern, um die Ausnahme "Klasse nicht gefunden" zu vermeiden. Im Folgenden ist die Beschattung Code in meinem pom.xml

<execution> 
    <phase>package</phase> 
    <goals> 
     <goal>shade</goal> 
    </goals> 
    <configuration> 
     <shadedClassifierName>jar-with-dependencies</shadedClassifierName> 
     <minimizeJar>false</minimizeJar> 
     <keepDependenciesWithProvidedScope>false</keepDependenciesWithProvidedScope> 
     <shadedArtifactAttached>true</shadedArtifactAttached> 
     <relocations> 
      <relocation> 
       <pattern>com.sun.jersey</pattern> 
       <shadedPattern>route66.com.sun.jersey</shadedPattern> 
      </relocation> 
     </relocations> 
     <transformers> 
      <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
       <mainClass>com.yahoo.infox.route66.udf.ContentExtractorUdf</mainClass> 
      </transformer> 
      <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> 
     </transformers> 
     <filters> 
      <filter> 
       <artifact>*:*</artifact> 
       <excludes> 
        <exclude>META-INF/*.SF</exclude> 
        <exclude>META-INF/*.DSA</exclude> 
        <exclude>META-INF/*.RSA</exclude> 
       </excludes> 
      </filter> 
     </filters> 
    </configuration> 
</execution> 

ich sogar ServicesResourceTransformer bin mit um sicherzustellen, dass alle Klassennamen in META_INF/Dienstleistungen ordnungsgemäß auch geändert werden.

Auch danach ich bin immer Fehler

SEVERE: The provider class, class route66.com.sun.jersey.multipart.impl.MultiPartReaderClientSide, could not be instantiated. Processing will continue but the class will not be utilized 
java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class? 
    at route66.com.sun.jersey.multipart.impl.MultiPartReaderClientSide.<init>(MultiPartReaderClientSide.java:107) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422) 
    at route66.com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:210) 
    at route66.com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:180) 
    at route66.com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166) 
    at route66.com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137) 
    at route66.com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:283) 
    at route66.com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:163) 
    at route66.com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176) 
    at route66.com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162) 
    at route66.com.sun.jersey.api.client.Client.init(Client.java:343) 
    at route66.com.sun.jersey.api.client.Client.access$000(Client.java:119) 
    at route66.com.sun.jersey.api.client.Client$1.f(Client.java:192) 
    at route66.com.sun.jersey.api.client.Client$1.f(Client.java:188) 
    at route66.com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) 
    at route66.com.sun.jersey.api.client.Client.<init>(Client.java:188) 
    at route66.com.sun.jersey.client.apache4.ApacheHttpClient4.<init>(ApacheHttpClient4.java:151) 
    at route66.com.sun.jersey.client.apache4.ApacheHttpClient4.<init>(ApacheHttpClient4.java:137) 
    at route66.com.sun.jersey.client.apache4.ApacheHttpClient4.create(ApacheHttpClient4.java:181) 

Jede Idee, was hier los?

Antwort

0

Dieses Problem tritt auf, da META-INF/services/com.sun.jersey * -Dateien nicht in shadedPattern umbenannt werden.

Es gibt ein offenes Problem auf Maven Schatten Plugin auf diesem.

Für jetzt folgte ich Hack erwähnt in Rename files inside a jar using some maven plugin, um mein Problem zu lösen.

Verwandte Themen