# Getting FileSystemNotFoundException when using programatically self-attached apm agent

**URL:** <https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829>\
**Category:** APM\
**Tags:** java\
**Created:** [July 28, 2022, 8:10am UTC](https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829 "2022-07-28T08:10:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![moser4035](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moser4035/32/101774_2.png) [@moser4035](https://discuss.elastic.co/u/moser4035)\
**Post date:** [July 28, 2022, 8:10am UTC](https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829/1 "2022-07-28T08:10:24Z")

</div>

**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](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-api.html)

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`:

```auto
@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:

```auto
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/:?]

```

---

<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:** [August 1, 2022, 8:14am UTC](https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829/2 "2022-08-01T08:14:29Z")

</div>

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.

---

<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:** [August 4, 2022, 1:55pm UTC](https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829/3 "2022-08-04T13:55:36Z")

</div>

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](https://github.com/spring-guides/gs-spring-boot/tree/main/complete)

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.

---

<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:** [August 25, 2022, 9:55am UTC](https://discuss.elastic.co/t/getting-filesystemnotfoundexception-when-using-programatically-self-attached-apm-agent/310829/4 "2022-08-25T09:55:49Z")

</div>

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