# Elastic cloud with APM monitoring Weblogic java application

**URL:** <https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447>\
**Category:** APM\
**Tags:** java\
**Created:** [March 24, 2023, 10:04am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447 "2023-03-24T10:04:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fr3ddy](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@Fr3ddy](https://discuss.elastic.co/u/Fr3ddy)\
**Post date:** [March 24, 2023, 10:04am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/1 "2023-03-24T10:04:34Z")

</div>

Hi,  
We are doing a proof of concept with elastic APM to monitor a weblogic 12.2.1.3 server with java 8. It runs a java enterprise application.

We have set it up with the elastic-apm-agent-1.36.0.jar as a startup parameter to weblogic. It has managed to connect with the cloud and is collecting some data, such as cpu usage, web transactions etc from weblogic. However non of the annotated methods show up in the collected data.

We have tried to put @CaptureTransaction and also @Traced on some different methods in our code and according to the documentation we should just set the application\_packages configuration to the root package of our code.

Ex:

application\_packages=com.swisslog.wm6

java code:

package com.swisslog.wm6.customer.impl.yard;

public class YardManagementMdb extends AbstractMdb {  
....

on one method:

@CaptureTransaction(type = "MDB")  
@Override  
protected void processMdbMessage(Message message)...

When looking at APM we do not find any transaction for type MDB.

We also tried using @Traced and it did not help either.

In addition we also tried to create a elasticapm.properties file with the same configuration into the same folder as the elastic-apm-agent-1.36.0.jar. This file seems to be read properly and any configuration changes there are reflected when restarting weblogic. However we are still not getting any transactions of type MDB captured.

Anyone know what we could be missing?

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [March 24, 2023, 11:43am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/2 "2023-03-24T11:43:57Z")

</div>

HI @Fr3ddy ,

Could you please provide us the [apm agent logs](https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-logging-procedure) at debug level? This will help us find the cause of your issues.

Based on your explanations I would guess that maybe `processMdbMessage` is called from inside an existing (e.g. JMS) transaction? In that case you should use `@Traced` to capture a span for `processMdbMessage`. It will however never appear as a transaction if it is called from inside an existing transaction.

You could add the following snippet to your `processMdbMessage` method:

```auto
ElasticApm.currentTransaction().setName("process Mdb Message")

```

This will allow you to rename the currently active transaction, so that you can more easily find it in the UI and treat it separately from other JMS transactions.

---

<div class="post-metadata">

**Author:** ![Fr3ddy](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@Fr3ddy](https://discuss.elastic.co/u/Fr3ddy)\
**Post date:** [March 24, 2023, 2:30pm UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/3 "2023-03-24T14:30:43Z")

</div>

It seems like you are correct. the JMS transactions behind our MDB causes the @Traced(type="MDB") to just use the existing span from the JMS transaction.

So when looking in APM in the list of types, the type named MDB is empty of any transactions.

I also tried with @Traced in another part of the code where we have a incomingWebRequest starting the transaction and we run into the same "issue" there where the type parameter is ignored.

It feels like it is difficult to instrument a java application with APM this way. Is there any document "best practice" for this out there?

Regards,  
Fredrik

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [March 24, 2023, 2:38pm UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/4 "2023-03-24T14:38:53Z")

</div>

You can also alter the [type](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-transaction-set-type) of the currently active `Transaction` from within your application code:

```auto
ElasticApm.currentTransaction().setType("MDB");

```

The `@Traced` annotation is actually not required in your case, unless you want the method call to `processMdbMessage` to appear as a span within your traces.

---

<div class="post-metadata">

**Author:** ![Fr3ddy](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@Fr3ddy](https://discuss.elastic.co/u/Fr3ddy)\
**Post date:** [March 27, 2023, 9:04am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/5 "2023-03-27T09:04:42Z")

</div>

Is it the elastic agent automatically traceing all the java transactions in the application automatically?  
Reading the documentation when it refered to transactions I just assumed it meant "elastic" transactions so I expected to have to use the annotations in order to collect any data.

I will try this setType("MDB") in my application and see if it does the trick 🙂

---

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [March 27, 2023, 9:37am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/6 "2023-03-27T09:37:13Z")

</div>

Within APM we use the term "transaction" for the first span within a service for a trace. You can read more about it [here](https://www.elastic.co/guide/en/apm/guide/current/data-model-transactions.html).

> Is it the elastic agent automatically traceing all the java transactions in the application automatically

Yes, at least for the [supported frameworks](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html).

---

<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:** [April 17, 2023, 5:38am UTC](https://discuss.elastic.co/t/elastic-cloud-with-apm-monitoring-weblogic-java-application/328447/7 "2023-04-17T05:38:12Z")

</div>

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