# @Traced does not work under Wildfly

**URL:** <https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140>\
**Category:** APM\
**Tags:** java\
**Created:** [November 20, 2020, 3:25pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140 "2020-11-20T15:25:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichalSuchecki](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MichalSuchecki](https://discuss.elastic.co/u/MichalSuchecki)\
**Post date:** [November 20, 2020, 3:25pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/1 "2020-11-20T15:25:43Z")

</div>

**Kibana version** :  
7.10.0  
**Elasticsearch version** :  
7.10.0  
**APM Server version** :  
7.10.0  
**APM Agent language and version** :  
Java/1.19.0  
**Browser version** :

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
Docker

**Fresh install or upgraded from other version?**  
Fresh

**Is there anything special in your setup?**  
No

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

I'm not able to use @Traced in my Wildfly 19 app. Ok, not exactly mine - it's a sample app from Wildfly - [https://github.com/wildfly/quickstart/tree/master/ejb-in-war](https://github.com/wildfly/quickstart/tree/master/ejb-in-war) just added @Traced here and there ([https://github.com/wildfly/quickstart/blob/master/ejb-in-war/src/main/java/org/jboss/as/quickstarts/ejbinwar/ejb/GreeterEJB.java](https://github.com/wildfly/quickstart/blob/master/ejb-in-war/src/main/java/org/jboss/as/quickstarts/ejbinwar/ejb/GreeterEJB.java) sayHello method, to be exact).  
I can see JSF traces in Kibana (splitted into JSF execute and JSF Render phase) which is fine but I don't see sayHello span, that I expected to see.

I'm able to create a span manually in the very same place which works absolutely fine but I would love to use @Traced instead.

**Steps to reproduce** :

1. clone [https://github.com/wildfly/quickstart/tree/master/ejb-in-war](https://github.com/wildfly/quickstart/tree/master/ejb-in-war)
2. add @Traced annotation to GreeterEJB.sayHello
3. mvn package and deploy to WF 19

My WF JAVA\_OPTS:

```auto
export JAVA_OPTS="$JAVA_OPTS -javaagent:elastic-apm-agent-1.19.0.jar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.application_packages=org.jboss.as.quickstarts.ejbinwar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.server_urls=http://localhost:8200"

```

---

<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:** [November 20, 2020, 3:51pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/2 "2020-11-20T15:51:42Z")

</div>

Hm, that's strange. Config looks ok at a first glance. Could you share your full debug logs from the startup until after the first invocation?

---

<div class="post-metadata">

**Author:** ![MichalSuchecki](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MichalSuchecki](https://discuss.elastic.co/u/MichalSuchecki)\
**Post date:** [November 20, 2020, 11:36pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/3 "2020-11-20T23:36:31Z")

</div>

Hi,  
WF startup logs and Elastic debug:

> <https://gist.github.com/msuchecki/69b7c4e9c6397f0f29b2ad0d403b3ebd>

---

<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:** [November 23, 2020, 8:57am UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/4 "2020-11-23T08:57:09Z")

</div>

I just tried it out in a standalone application to be sure and it works for me in version 1.19.0.

Can you make sure that you're indeed using the `co.elastic.apm.api.Traced` annotation and that the `apm-agent-api` module is available on the classpath? Does the `@CaptureSpan` annotation work for you?

---

<div class="post-metadata">

**Author:** ![MichalSuchecki](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MichalSuchecki](https://discuss.elastic.co/u/MichalSuchecki)\
**Post date:** [November 23, 2020, 9:40am UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/5 "2020-11-23T09:40:32Z")

</div>

Hi,  
@Traced in standalone app works for me too.

As for Wildfly - I do confirm that I use co.elastic.apm.api.Traced. Also tried @CaptureSpan and @CaptureTransaction unfortunately with no luck. Apm-agent-api is part of ear (manual span creation works fine).  
Also tried to add a Wildfly's global module ([http://docs.wildfly.org/19/Developer\_Guide.html#global-modules](http://docs.wildfly.org/19/Developer_Guide.html#global-modules)) that would include apm-agent-api, to be sure that Traced is accessible, still no luck.

---

<div class="post-metadata">

**Author:** ![MichalSuchecki](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MichalSuchecki](https://discuss.elastic.co/u/MichalSuchecki)\
**Post date:** [November 24, 2020, 2:05pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/6 "2020-11-24T14:05:36Z")

</div>

Hi there,  
good news, or just a news - I made it work by changing package from org.jboss.as.quickstarts to org.jboss.asas.quickstarts. Is there something wrong with 'org.jboss.as' being part of a package name? Is it anyhow protected by WF?

---

<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:** [November 24, 2020, 2:45pm UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/7 "2020-11-24T14:45:21Z")

</div>

Ah, right.. We're not instrumenting `org.jboss.as` by default to shave off a few seconds of overhead on startup.

See also

> <https://github.com/elastic/apm-agent-java/blob/ea984c7e342c6177ef0a35749d4c77c2d507c1e9/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java#L384>

---

<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 15, 2020, 10:45am UTC](https://discuss.elastic.co/t/traced-does-not-work-under-wildfly/256140/8 "2020-12-15T10:45:48Z")

</div>

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