Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法创建tempDir。java.io.tmpdir设置为/tmp_Java_Spring_Spring Boot_Jar - Fatal编程技术网

无法创建tempDir。java.io.tmpdir设置为/tmp

无法创建tempDir。java.io.tmpdir设置为/tmp,java,spring,spring-boot,jar,Java,Spring,Spring Boot,Jar,在ubuntu服务器上运行我的springboot web服务java jar应用程序会导致如下所示的错误,我对错误做了一些研究,但是我无法找到解决方案。我用来运行jar文件的命令是 java -jar mySpringBootApp.jar 您的应用程序用户可能没有足够的权限装箱/tmp目录中的任何内容。。。请参阅由以下原因引起的最后一条消息:java.io.IOException:只读文件系统 1) 更改/tmp的权限以授予用户访问权限。 chmod-R 777/tmp 确保使用sudo访

在ubuntu服务器上运行我的springboot web服务java jar应用程序会导致如下所示的错误,我对错误做了一些研究,但是我无法找到解决方案。我用来运行jar文件的命令是

java -jar mySpringBootApp.jar

您的应用程序用户可能没有足够的权限装箱
/tmp
目录中的任何内容。。。请参阅由以下原因引起的最后一条消息:java.io.IOException:只读文件系统

1) 更改/tmp的权限以授予用户访问权限。 chmod-R 777/tmp 确保使用sudo访问权限(root)运行上述命令


2) 添加要加入sudo组的用户

对于从Intellij IDEA运行时在运行/调试配置中提供环境变量时遇到相同异常的用户:
请查看是否选中了“包含父环境变量”

如果您确实没有权限,我可以在第一次尝试时为其授予权限吗。。。类似于
touch/tmp/testfile.txt的命令可能会给出一个结果。如果它告诉您您没有权限,请尝试
chmod 1777/tmp
当我运行第一个命令“`touch:cannot touch'/tmp/testfile.txt”:只读文件系统“``时出现此错误,当我运行最后一个命令时,我得到chmod:changing permissions of'/tmp':只读文件系统向用户授予写入tmp或使用jvm选项-Djava.io.tmpdir=,更改tmp目录。

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:157) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at aacctt.payments.org.Application.main(Application.java:18) [classes!/:0.0.1-SNAPSHOT]
    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:48) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [ mySpringBootApp-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
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:182) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:162) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    ... 16 common frames omitted
Caused by: java.io.IOException: Read-only file system
    at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.8.0_191]
    at java.io.File.createTempFile(File.java:2024) ~[na:1.8.0_191]
    at java.io.File.createTempFile(File.java:2070) ~[na:1.8.0_191]
    at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:173) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
    ... 19 common frames omitted