Getting FileSystemNotFoundException when using programatically self-attached apm agent

APM Server version: v8.3.0

APM Agent language and version: Java 1.33.0

Hi,

I followed the instruction to set up the self-attached APM agent: Programmatic API setup to self-attach | APM Java Agent Reference [1.x] | Elastic

I'm using the hosted solution trial for now.

I also use Spring as shown in the instruction. This is how my integration looks like.

Application.java:

@SpringBootApplication
public class Application {
  public static void main(String[] args) {
    ElasticApmAttacher.attach();
    ....
  }
....

It seems that the agent is starting up, but I can not see any traces besides some of the out of the box HTTP request tracces.

When I check the logs of the apm-agent I see the following error:

2022-07-27 15:17:30,088 [main] ERROR co.elastic.apm.agent.bci.IndyBootstrap - /tmp/elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-86822b39e3d2d51b43d223be133a44ec.jar
java.nio.file.FileSystemNotFoundException: /tmp/elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-86822b39e3d2d51b43d223be133a44ec.jar
        at jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:123) ~[jdk.zipfs:?]
        at jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:109) ~[jdk.zipfs:?]
        at java.nio.file.FileSystems.newFileSystem(FileSystems.java:337) ~[?:?]
        at java.nio.file.FileSystems.newFileSystem(FileSystems.java:286) ~[?:?]
        at co.elastic.apm.agent.util.PackageScanner.getClassNames(PackageScanner.java:61) ~[elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-86822b39e3d2d51b43d223be133a44ec.jar:1.33.0]
        at co.elastic.apm.agent.bci.IndyBootstrap.getClassNamesFromBundledPlugin(IndyBootstrap.java:440) ~[elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-86822b39e3d2d51b43d223be133a44ec.jar:1.33.0]
        at co.elastic.apm.agent.bci.IndyBootstrap.bootstrap(IndyBootstrap.java:399) [elastic-apm-agent-4813494d137e1631bba301d5acab6e7b-86822b39e3d2d51b43d223be133a44ec.jar:1.33.0]
        at jdk.internal.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at java.lang.IndyBootstrapDispatcher.bootstrap(IndyBootstrapDispatcher.java:60) [?:?]
        at java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138) [?:?]
        at java.lang.invoke.CallSite.makeSite(CallSite.java:307) [?:?]
        at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258) [?:?]
        at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248) [?:?]
        at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory$Initializer.onStartup(UndertowServletWebServerFactory.java:507) [spring-boot-2.7.2.jar:2.7.2]
        at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:204) [undertow-servlet-2.2.18.Final.jar:2.2.18.Final]
        at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187) [undertow-servlet-2.2.18.Final.jar:2.2.18.Final]
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) [undertow-servlet-2.2.18.Final.jar:2.2.18.Final]
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.2.18.Final.jar:2.2.18.Final]
        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255) [undertow-servlet-2.2.18.Final.jar:2.2.18.Final]
        at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.createManager(UndertowServletWebServerFactory.java:330) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.getWebServer(UndertowServletWebServerFactory.java:299) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) [spring-context-5.3.22.jar:5.3.22]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) [spring-boot-2.7.2.jar:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) [spring-boot-2.7.2.jar:2.7.2]
        at com.bitmovin.api.encodings.encoder.Application.main(Application.java:21) [classes/:?]

Thanks for reporting this issue @moser4035 , could you provide a bit more information to help us reproducing it ?

  • which version of Spring/Spring boot are you using here ?
  • how is the application packaged and executed, for example is it packaged & run in a container ?
  • do you have a code sample or a link to a sample app to allow reproducing it ?

In the mean time, I might try to reproduce it on my side, but any hint here would help fixing this faster.
Thanks in advance.

I did not manage to reproduce the issue using a sample spring-boot application: gs-spring-boot/complete at main · spring-guides/gs-spring-boot · GitHub

I have only run this locally, and not within a container, which makes me think it might be related to the way the application is packaged and executed, so @moser4035 if you have a bit more context it would definitely help to sort this out.

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