# APM Java Agent : No instrumentation/response from public api

**URL:** <https://discuss.elastic.co/t/apm-java-agent-no-instrumentation-response-from-public-api/160165>\
**Category:** APM\
**Created:** [December 10, 2018, 12:26pm UTC](https://discuss.elastic.co/t/apm-java-agent-no-instrumentation-response-from-public-api/160165 "2018-12-10T12:26:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BSP](https://avatars.discourse-cdn.com/v4/letter/b/9fc29f/32.png) [@BSP](https://discuss.elastic.co/u/BSP)\
**Post date:** [December 10, 2018, 12:26pm UTC](https://discuss.elastic.co/t/apm-java-agent-no-instrumentation-response-from-public-api/160165/1 "2018-12-10T12:26:17Z")

</div>

Hi There,  
I was trying with public API of APM to get response for my custom class but I don't see any such information on Kibana or instrumentation details on APM java agent log.  
Not sure what I am doing wrong. I had tried with @CaptureTransaction .  
In this method I am intentionally throwing a null pointer exception to see it in Kibana.  
@Override  
public String getTestName() {  
Transaction transaction = ElasticApm.startTransaction();  
String a=null;  
try(final Scope scope = transaction.activate())  
{  
transaction.setName("CustomUserBOPreferencesExtensionImpl#TestName");  
transaction.setType(Transaction.TYPE\_REQUEST);

```
        return a.toString();
    }
    catch (Exception e) {
        transaction.captureException(e);
        throw e;
    } finally {
        transaction.end();
    }

}
```

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [December 10, 2018, 1:17pm UTC](https://discuss.elastic.co/t/apm-java-agent-no-instrumentation-response-from-public-api/160165/2 "2018-12-10T13:17:48Z")

</div>

Hi and thanks for trying out Elastic APM 🙂

Have you added the agent as a `-javaagent` flag? This is required even when using the public API.

Cheers,  
Felix

---

<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:** [December 31, 2018, 9:17am UTC](https://discuss.elastic.co/t/apm-java-agent-no-instrumentation-response-from-public-api/160165/3 "2018-12-31T09:17:49Z")

</div>

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