tomcat-Approved&错误:无法创建jvm

gwo2fgha  于 2021-10-10  发布在  Java
关注(0)|答案(1)|浏览(351)

我尝试在eclipse中使用二进制文件安装tomcat server。当我运行cmd并运行startup命令时,cmd会打开和关闭,并在cmd屏幕上写入以下内容:

>startup
Using CATALINA_BASE:   "C:\Program Files\Tomcat\apache-tomcat-8.5.69"
Using CATALINA_HOME:   "C:\Program Files\Tomcat\apache-tomcat-8.5.69"
Using CATALINA_TMPDIR: "C:\Program Files\Tomcat\apache-tomcat-8.5.69\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk-15.0.2"
Using CLASSPATH:       "C:\Program Files\Tomcat\apache-tomcat-8.5.69\bin\bootstrap.jar;C:\Program Files\Tomcat\apache-tomcat-8.5.69\bin\tomcat-juli.jar"

(startup.bat也尝试过,但行为相同)
运行此命令时:
卡塔琳娜·巴特跑

Using CATALINA_BASE:   "C:\Program Files\Tomcat\apache-tomcat-8.5.69"
Using CATALINA_HOME:   "C:\Program Files\Tomcat\apache-tomcat-8.5.69"
Using CATALINA_TMPDIR: "C:\Program Files\Tomcat\apache-tomcat-8.5.69\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk-15.0.2"
Using CLASSPATH:       "C:\Program Files\Tomcat\apache-tomcat-8.5.69\bin\bootstrap.jar;C:\Program Files\Tomcat\apache-tomcat-8.5.69\bin\tomcat-juli.jar"
-Djava.endorsed.dirs=C:\Program Files\Tomcat\apache-tomcat-8.5.69\endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
>java -version

java版本“15.0.2”2021-01-19
java(tm)se运行时环境(构建15.0.2+7-27)
java hotspot(tm)64位服务器虚拟机(构建15.0.2+7-27,混合模式,共享)

>javac -version

JavaC15.0.2
在项目中,jre设置如下:
项目->属性->java构建路径->库->jre系统库->javase-1.8
eclipse版本为:
面向java开发人员的eclipse ide(包括孵化组件)
版本:2020-12(4.18.0)

>echo %CATALINA_HOME%

c:\ProgramFiles\tomcat\apache-tomcat-8.5.69

>echo %JAVA_HOME%

%catalina\u home%\bin存在于路径变量中。
c:\ProgramFiles\java\jdk-15.0.2

shyt4zoc

shyt4zoc1#

来自catalina.bat的源代码。

234 rem Java 9 no longer supports the java.endorsed.dirs
  235 rem system property. Only try to use it if
  236 rem JAVA_ENDORSED_DIRS was explicitly set
  237 rem or CATALINA_HOME/endorsed exists.
  238 set ENDORSED_PROP=ignore.endorsed.dirs
  239 if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar
  240 set ENDORSED_PROP=java.endorsed.dirs
  241 goto doneEndorsed
  242 :noEndorsedVar
  243 if not exist "%CATALINA_HOME%\endorsed" goto doneEndorsed
  244 set ENDORSED_PROP=java.endorsed.dirs
  245 :doneEndorsed

此外,从错误消息中可以看出,属性是在tomcat启动命令行上传递的: -Djava.endorsed.dirs= ... 所以 JAVA_ENDORSED_DIRS 环境变量存在或不存在 CATALINA_HOME/endorsed 目录存在。

相关问题