# APM Java Agent crashes with Springboot 2

**URL:** <https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330>\
**Category:** APM\
**Tags:** java\
**Created:** [August 29, 2019, 11:50am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330 "2019-08-29T11:50:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [August 29, 2019, 11:50am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/1 "2019-08-29T11:50:32Z")

</div>

The same project runs with APM 1.8 Javaclient but with 1.9.0 the JVM crashes without any information from program

pom.xml

```xml
       <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.7.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<version.elastic.apm>1.9.0</version.elastic.apm>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>co.elastic.apm</groupId>
			<artifactId>apm-agent-attach</artifactId>
			<version>${version.elastic.apm}</version>
		</dependency>
		<dependency>
			<groupId>co.elastic.apm</groupId>
			<artifactId>apm-agent-api</artifactId>
			<version>${version.elastic.apm}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

```

Starter class

```java
    public static void main(String[] args) {
Map<String, String> options = new HashMap<>();
options.put("service_name", simulation");
options.put("application_packages", "eu.amova,com.siemag,pas.core");
options.put("elastic.apm.stack_trace_limit", "0");
options.put("elastic.apm.span_frames_min_duration", "0ms");
options.put("disable_instrumentations", "elasticsearch-restclient,concurrent,executor,jax-rs,jax-ws,jdbc,scheduled");
options.put("server_urls", apm_server_urls);
ElasticApmAttacher.attach(options);
SpringApplication.run(DemoApplication.class, args);
}

```

---

<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:** [August 29, 2019, 2:39pm UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/2 "2019-08-29T14:39:32Z")

</div>

I'm sorry to hear that. On which Java version, vendor and OS does that happen?

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [August 29, 2019, 2:41pm UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/3 "2019-08-29T14:41:35Z")

</div>

java version "1.8.0\_171"  
Java(TM) SE Runtime Environment (build 1.8.0\_171-b11)  
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

With Windows 10 host

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [August 29, 2019, 2:47pm UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/4 "2019-08-29T14:47:31Z")

</div>

But it is the same with OpenJDK 12.0.1 and langugage level 12

---

<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:** [August 29, 2019, 3:33pm UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/5 "2019-08-29T15:33:04Z")

</div>

Any crash reports from the JVM? Look out for `hs_err_pid<pid>.log` in the current directory.

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [August 30, 2019, 6:18am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/6 "2019-08-30T06:18:51Z")

</div>

nope 😡

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [August 30, 2019, 6:20am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/7 "2019-08-30T06:20:49Z")

</div>

but you should easily reproduce it.  
Create a project from springinitzlr site and add apm agent version 1.9 😉

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [September 9, 2019, 7:09am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/8 "2019-09-09T07:09:23Z")

</div>

Did you make any progress on this issue ?

---

<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:** [September 9, 2019, 7:27am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/9 "2019-09-09T07:27:55Z")

</div>

Sorry for the radio silence. I was on vacation last week. I'll try to reproduce at home where I have a Win 10 desktop PC. My inbox is kinda exploding but I'll try to investigate this asap.

---

<div class="post-metadata">

**Author:** ![nugusbayevkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nugusbayevkk/32/126683_2.png) [@nugusbayevkk](https://discuss.elastic.co/u/nugusbayevkk)\
**Post date:** [September 9, 2019, 11:05am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/10 "2019-09-09T11:05:57Z")

</div>

Did you try run this on ubuntu?  
On ubuntu application started success:

```auto
nindzya@pc:/opt/nindzya$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/f/ef6ef0b71611086c0fe125239870be0718319eaa.png)

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [September 12, 2019, 11:30am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/11 "2019-09-12T11:30:30Z")

</div>

Pitty that's not a solution for me.

The company have a Microsoft infrastructure 😡

---

<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:** [September 13, 2019, 11:05am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/12 "2019-09-13T11:05:55Z")

</div>

I could finally reproduce it. It's currently a restriction of the emulated attach on Windows (see also [https://github.com/raphw/byte-buddy/issues/723](https://github.com/raphw/byte-buddy/issues/723)). It crashes the VM if the agent arguments are too long.

A workaround for this is to use system properties for the configuration:

```java
public static void main(String[] args) {
    System.setProperty("elastic.apm.service_name", "simulation");
    System.setProperty("elastic.apm.application_packages", "eu.amova,com.siemag,pas.core");
    System.setProperty("elastic.apm.stack_trace_limit", "0");
    System.setProperty("elastic.apm.span_frames_min_duration", "0ms");
    System.setProperty("elastic.apm.disable_instrumentations", "elasticsearch-restclient,concurrent,executor,jax-rs,jax-ws,jdbc,scheduled");
    System.setProperty("elastic.apm.server_urls", apm_server_urls);
    ElasticApmAttacher.attach();
    SpringApplication.run(DemoApplication.class, args);
}

```

---

<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:** [October 4, 2019, 7:05am UTC](https://discuss.elastic.co/t/apm-java-agent-crashes-with-springboot-2/197330/13 "2019-10-04T07:05:57Z")

</div>

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