# How solve "GET unknown route" from APM Java?

**URL:** <https://discuss.elastic.co/t/how-solve-get-unknown-route-from-apm-java/209364>\
**Category:** APM\
**Tags:** java\
**Created:** [November 25, 2019, 7:33pm UTC](https://discuss.elastic.co/t/how-solve-get-unknown-route-from-apm-java/209364 "2019-11-25T19:33:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dancristian](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dancristian](https://discuss.elastic.co/u/dancristian)\
**Post date:** [November 25, 2019, 7:33pm UTC](https://discuss.elastic.co/t/how-solve-get-unknown-route-from-apm-java/209364/1 "2019-11-25T19:33:17Z")

</div>

**Kibana version** :  
7.4.0

**Elasticsearch version** :  
7.4.0

**APM Server version** :  
7.4.0

**APM Agent language and version** :  
APM Agent 1.7.0

**Browser version** :  
Chrome 78.0.3904

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
ELK Stack URL Download: [docker.elastic.co/elasticsearch](http://docker.elastic.co/elasticsearch) , Kibana and Beats  
APM Agent URL Download: [https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.7.0/elastic-apm-agent-1.7.0.jar](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.7.0/elastic-apm-agent-1.7.0.jar)

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

I installed and let the ELK Stack configuration default. After that, i installed APM Agent Java in Tomcat Server and edited the setenv.sh:

> export CATALINA\_OPTS="-Xms512M -Xmx3072M"  
> export CATALINA\_OPTS="$CATALINA\_OPTS -javaagent:/opt/tomcat/elastic-apm-agent-1.7.0.jar"  
> export CATALINA\_OPTS="$CATALINA\_OPTS -Delastic.apm.service\_name=tomcat-appx"  
> export CATALINA\_OPTS="$CATALINA\_OPTS -Delastic.apm.application\_packages=appx"  
> export CATALINA\_OPTS="$CATALINA\_OPTS -Delastic.apm.server\_urls=[http://192.168.0.44:8200](http://192.168.0.44:8200)"

I followed the wizard to enable APM Server and add service "tomcat-appx".

Some transactions was classified like "GET Unknown route".

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/0/90d1e637e7e74cb54e13cf1a91f950bb8b6c37ea.png)

How can i solved this?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [November 26, 2019, 11:17am UTC](https://discuss.elastic.co/t/how-solve-get-unknown-route-from-apm-java/209364/2 "2019-11-26T11:17:30Z")

</div>

Hi @dancristian,

By default, transactions are named with the Servlet name that handled the request.  
Thus, if request does not reach a servlet, you get those `unknown route` transactions.

There are two possible cases:

- your requests reach a servlet but Elastic agent is not properly able to detect those
- your requests do not reach a servlet: handled by filter, static resources, ...

Regarding detection of Servlets, agent has a 'pre-filter' heuristic to only consider classes which name  
ends with 'Servlet'. This heuristic can be disabled by setting the internal configuration `enable_type_matching_name_pre_filtering=false`.  
Please note that this has an impact on all plugins, thus a small extra overhead during application startup time is expected.

In the second case, it is possible to change the default transaction naming to use URL path instead.  
[use\_path\_as\_transaction\_name](https://www.elastic.co/guide/en/apm/agent/java/current/config-http.html#config-use-path-as-transaction-name).

The major implication is that it may create lots of duplicate transactions if they have similar paths  
like `/usr/{id}` where `{id}` is the user ID, you can get as many transactions as there are users.

Thus, if required, you can mitigate this by using  
[url\_groups](https://www.elastic.co/guide/en/apm/agent/java/current/config-http.html#config-url-groups), which will allow to use wildcards in transaction URLs.

Another option is to set transaction names using our API:

- use [ElasticApm.currentTransaction()](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-current-transaction) to get current transaction
- use [Transaction#setName(String name)](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-set-name) to set transaction name

Also, could you provide us some details about the application ?  
For example do you have a list of all servlets that should be instrumented ?

---

<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 17, 2019, 7:29am UTC](https://discuss.elastic.co/t/how-solve-get-unknown-route-from-apm-java/209364/3 "2019-12-17T07:29:55Z")

</div>

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