【问题标题】:Marklogic java client-api exception via shadow jar build via gradleMarklogic java client-api异常通过shadow jar构建通过gradle
【发布时间】:2016-07-07 22:39:03
【问题描述】:

我正在使用 marklogic java client-api 来提取文档,在我的 intellij 中它工作正常,但是当我构建一个影子 jar 并运行它时,我得到以下异常

com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: A message body writer for Java class com.marklogic.client.impl.StreamingOutputImpl, and Java type class com.marklogic.client.impl.StreamingOutputImpl, and MIME media type application/xml was not found
Jul 07, 2016 5:29:53 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: The registered message body writers compatible with the MIME media type are:

我正在使用 gradle 构建 shadow jar.. 而我的 build.gradle 看起来像以下

buildscript {
    repositories { jcenter() }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
    }
}

apply plugin: 'java'
apply plugin: 'wrapper'
apply plugin: 'com.github.johnrengelman.shadow'

sourceCompatibility = 1.7
targetCompatibility = 1.7

repositories {
    mavenLocal()
    maven {
        url "http://nexus.abbvienet.com/content/groups/public"
    }
}

import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
shadowJar {
    transform(AppendingTransformer) {
        resource = 'META-INF/services'
    }

}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.12'
    compile 'ch.qos.logback:logback-classic:1.1.3'
    compile 'com.moonlight:lfsappenders:4.0.3'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
    compile group: 'commons-io', name: 'commons-io', version: '2.4'
    compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
    compile group: 'com.marklogic', name: 'java-client-api', version: '3.0.1'
    compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
    compile group: 'org.jdom', name: 'jdom2', version: '2.0.5'
    compile group: 'xom', name: 'xom', version: '1.2.5'
    compile group: 'jaxen', name: 'jaxen', version: '1.1.6'
    compile group: 'net.sourceforge.htmlcleaner', name: 'htmlcleaner', version: '2.4'
    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.4.1'
    compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.4.1'
    compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
}

我认为这与我的电车形式有关......我错过了什么吗?

谢谢,

【问题讨论】:

    标签: marklogic marklogic-8


    【解决方案1】:

    我能够解决我的问题.. 导致错误的问题是合并来自各种 jar 的 META-INF/服务.. 在我的 build.gradle 中,我使用了错误的转换.. 我更改了从上面的 build.gradle 开始,一切正常..

    原始部分

    import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
    
            shadowJar {
                transform(AppendingTransformer) {
                    resource = 'META-INF/services'
                }
    
            }
    

    改为如下

    shadowJar {
        mergeServiceFiles()
    }
    

    我使用了错误的转换..我需要合并我所有的服务文件..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-22
      • 1970-01-01
      • 2016-02-08
      • 1970-01-01
      相关资源
      最近更新 更多