# Java plugin - Irrelevant JARs are loaded and cause conflicts

**URL:** <https://discuss.elastic.co/t/java-plugin-irrelevant-jars-are-loaded-and-cause-conflicts/272276>\
**Category:** Logstash\
**Created:** [May 6, 2021, 10:20am UTC](https://discuss.elastic.co/t/java-plugin-irrelevant-jars-are-loaded-and-cause-conflicts/272276 "2021-05-06T10:20:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MosheElisha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mosheelisha/32/88311_2.png) [@MosheElisha](https://discuss.elastic.co/u/MosheElisha)\
**Post date:** [May 6, 2021, 10:20am UTC](https://discuss.elastic.co/t/java-plugin-irrelevant-jars-are-loaded-and-cause-conflicts/272276/1 "2021-05-06T10:20:55Z")

</div>

Hi,

I am creating a Java input plugin that uses 'software.amazon.awssdk:s3:2.16.26' and libraries from `manticore-0.7.0-java` are loaded into my plugin and cause conflicts.

After successful installation, when I try to use the plugin I get the following error:

```auto
[2021-05-06T09:38:47,640][FATAL][org.logstash.Logstash][main][4a185b63cbba2ea2d3e1b0a33bead708588ed3bb1e55cff5f78bf05ea03c034b] uncaught error (in thread main_logim_s3_4a185b63cbba2ea2d3e1b0a33bead708588ed3bb1e55cff5f78bf05ea03c034b)
    java.lang.BootstrapMethodError: bootstrap method initialization exception
    ...
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair

```

I understand I need to make sure I am using http-core \>= 4.4.9 but I am.  
To understand why it is failing, I added the following log statement:

`log.atInfo().log("Header class location: [{}]", Class.forName("org.apache.http.Header").getProtectionDomain().getCodeSource().getLocation().getPath());`

and the log shows:

`Header class location: [/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/manticore-0.7.0-java/lib/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar]`

When I run logstash locally and use my plugin I see the following log message:

```auto
Header class location: [/C:/Users/melisha/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar]

```

How can I prevent those JARs to be loaded into my plugin? I would like only the plugin dependencies to be loaded. These are my gradle project dependencies:

```auto
dependencies {
        implementation 'org.apache.commons:commons-compress:1.20'
        implementation 'org.apache.logging.log4j:log4j-api:2.14.1'
        implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
        implementation 'software.amazon.awssdk:s3:2.16.26'
        implementation fileTree(dir: LOGSTASH_CORE_PATH, include: "**/logstash-core-?.??.?.jar")

// Adding the below dependencies does not help
// implementation 'org.apache.httpcomponents:httpclient:4.5.13'
// implementation 'org.apache.httpcomponents:httpcore:4.4.14'
// implementation 'org.apache.httpcomponents:httpmime:4.5.13'

        testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
        testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 3, 2021, 10:21am UTC](https://discuss.elastic.co/t/java-plugin-irrelevant-jars-are-loaded-and-cause-conflicts/272276/2 "2021-06-03T10:21:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
