# Failed to find Premain-Class manifest attribute

**URL:** <https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887>\
**Category:** APM\
**Tags:** java\
**Created:** [June 3, 2019, 6:26am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887 "2019-06-03T06:26:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tahseen\_fatima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tahseen_fatima/32/67789_2.png) [@tahseen\_fatima](https://discuss.elastic.co/u/tahseen_fatima)\
**Post date:** [June 3, 2019, 6:26am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/1 "2019-06-03T06:26:50Z")

</div>

Hi,  
I am setting up with elastic java apm  
And here are my configurations.

```
        ELK version 6.5.4
        APM Server version 6.5.4   
       apm-agent-attach-1.5.0.jar

```

`When I try to run a java code I get the following error.`

```
Failed to find Premain-Class manifest attribute in /home/abc/Desktop/apm-agent-attach-1.5.0.jar
Error occurred during initialization of VM
agent library failed to init: instrument

```

Kindly help.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [June 3, 2019, 7:20am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/2 "2019-06-03T07:20:56Z")

</div>

It seems you are trying to install the agent using the [-javaagent startup flag](https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html), while referring to the [attach jar](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-cli.html), instead of the `elastic-apm-agent-<version>.jar`.  
Please read through [our documentation regarding the different setup options](https://www.elastic.co/guide/en/apm/agent/java/current/setup.html).

---

<div class="post-metadata">

**Author:** ![tahseen\_fatima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tahseen_fatima/32/67789_2.png) [@tahseen\_fatima](https://discuss.elastic.co/u/tahseen_fatima)\
**Post date:** [June 3, 2019, 7:32am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/3 "2019-06-03T07:32:31Z")

</div>

I have downloaded the `elastic-apm-agent-1.5.0`  
But while running a java code I am facing problem its giving the following error.

```
Failed to find Premain-Class manifest attribute in /home/abc/Desktop/apm-agent-attach-1.5.0.jar
Error occurred during initialization of VM
agent library failed to init: instrument
```

---

<div class="post-metadata">

**Author:** ![tahseen\_fatima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tahseen_fatima/32/67789_2.png) [@tahseen\_fatima](https://discuss.elastic.co/u/tahseen_fatima)\
**Post date:** [June 3, 2019, 7:38am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/4 "2019-06-03T07:38:54Z")

</div>

I made .war file of java code.  
Can I run .war file from terminal.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [June 3, 2019, 7:49am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/5 "2019-06-03T07:49:17Z")

</div>

You need a running Java app. If it is running on one of the [supported app servers](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html#supported-app-servers), follow [setup instructions](https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html#application-server-setup). Otherwise, go over installation options and [manual tracing API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html) to review your options.

---

<div class="post-metadata">

**Author:** ![tahseen\_fatima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tahseen_fatima/32/67789_2.png) [@tahseen\_fatima](https://discuss.elastic.co/u/tahseen_fatima)\
**Post date:** [June 3, 2019, 7:51am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/6 "2019-06-03T07:51:55Z")

</div>

okay  
Thank you.  
In case of any doubt I'll revert you back.

---

<div class="post-metadata">

**Author:** ![tahseen\_fatima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tahseen_fatima/32/67789_2.png) [@tahseen\_fatima](https://discuss.elastic.co/u/tahseen_fatima)\
**Post date:** [June 4, 2019, 8:05am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/7 "2019-06-04T08:05:05Z")

</div>

Earlier it was working fine but now I am getting the error whenever I try to run apm server.

```
|2019-06-04T13:24:02.531+0530|INFO|pipeline/output.go:105|Connection to backoff(elasticsearch(http://172.25.8.45:9200)) established
|2019-06-04T13:24:04.136+0530|ERROR|pipeline/output.go:121|Failed to publish events: temporary bulk send failure|
|2019-06-04T13:24:04.136+0530|INFO|pipeline/output.go:95|Connecting to backoff(elasticsearch(http://172.25.8.45:9200))|
|2019-06-04T13:24:04.140+0530|INFO|elasticsearch/client.go:729|Connected to Elasticsearch version 6.7.0|
|2019-06-04T13:24:04.145+0530|INFO|template/load.go:128|Template already exists and will not be overwritten.|
|2019-06-04T13:24:04.145+0530|INFO|instance/beat.go:890|Template successfully loaded.|

```

Kindly guide.

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [June 4, 2019, 10:57am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/8 "2019-06-04T10:57:04Z")

</div>

Could you [set the log level](https://www.elastic.co/guide/en/apm/server/7.1/configuration-logging.html) on the server to `debug` to find more information about why publishing events fails.

---

<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 25, 2019, 7:05am UTC](https://discuss.elastic.co/t/failed-to-find-premain-class-manifest-attribute/183887/9 "2019-06-25T07:05:16Z")

</div>

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