启动jar包报错 java.nio.file.FileSystemException: /tmp/tomcat.8001.8924344540667220238: 设备上没有空间

当启动jar包时遇到`java.nio.file.FileSystemException`,提示设备上没有空间,可以尝试手动创建临时文件目录或者在启动时通过`-Djava.io.tmpdir`参数指定临时目录,例如`java -Djava.io.tmpdir=/home/tmp -jar project.jar & > project.log`。
 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.5)

2021-07-27 11:19:29.428  WARN 18553 --- [           main] o.s.boot.StartupInfoLogger               : InetAddress.getLocalHost().getHostName() took 20015 milliseconds to respond. Please verify your network configuration.
2021-07-27 11:19:49.445  INFO 18553 --- [           main] com.techstar.jb_data.JbDateApplication   : Starting JbDateApplication v1 using Java 1.8.0_191 with PID 18553 (/home/jibei/jb_data-1.jar started by root in /home/jibei)
2021-07-27 11:19:49.446  INFO 18553 --- [           main] com.techstar.jb_data.JbDateApplication   : No active profile set, falling back to default profiles: default
2021-07-27 11:19:50.683  WARN 18553 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
2021-07-27 11:19:50.695  INFO 18553 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-07-27 11:19:50.721 ERROR 18553 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.6.jar!/:5.3.6]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) [spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) [spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) [spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) [spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [spring-boot-2.4.5.jar!/:2.4.5]
    at com.techstar.jb_data.JbDateApplication.main(JbDateApplication.java:12) [classes!/:1]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [jb_data-1.jar:1]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [jb_data-1.jar:1]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [jb_data-1.jar:1]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [jb_data-1.jar:1]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
    at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:195) ~[spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:186) ~[spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.5.jar!/:2.4.5]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.5.jar!/:2.4.5]
    ... 17 common frames omitted
Caused by: java.nio.file.FileSystemException: /tmp/tomcat.8001.8924344540667220238: 设备上没有空间
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91) ~[na:1.8.0_191]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.8.0_191]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.8.0_191]
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[na:1.8.0_191]
    at java.nio.file.Files.createDirectory(Files.java:674) ~[na:1.8.0_191]
    at java.nio.file.TempFileHelper.create(TempFileHelper.java:136) ~[na:1.8.0_191]
    at java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:173) ~[na:1.8.0_191]
    at java.nio.file.Files.createTempDirectory(Files.java:991) ~[na:1.8.0_191]
    at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:189) ~[spring-boot-2.4.5.jar!/:2.4.5]
    ... 20 common frames omitted


 

解决办法:

1、在磁盘上手工建立一个存放零时文件的目录;

2、启动时指定零时目录: java -Djava.io.tmpdir=/home/tmp -jar project.jar & > project.log

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值