gpt4 book ai didi

java - OSX 10.9.1 : "Tomcat started." localhost:8080 says "no data received"

转载 作者:行者123 更新时间:2023-11-28 22:42:54 25 4
gpt4 key购买 nike

我花了几个小时尝试安装 Tomcat 并运行服务器,但仍然一无所获。

❯ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents

❯ bash startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /Library/Tomcat/tomcat.pid
Existing PID file found during start.
Removing/clearing stale PID file.

Tomcat started.

/Library/Tomcat/bin

localhost:8080 仍然没有加载。

Chrome: "no data received"

我已经检查过,没有其他进程正在使用该端口。我还添加了一个虚拟用户。仍然没有。

<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>

配置测试:

❯ ./catalina.sh configtest
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /Library/Tomcat/tomcat.pid
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Configuration error detected!

❯ which java
/usr/bin/java

❯ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

但是,出于某种原因,我的系统偏好设置中显示了 1.7。

Java OSX System Prefs

我什至尝试了 Tomcat Controller ,但它说也有一些配置不正确。如果这些错误能准确告诉我问题出在哪里,那将非常有帮助。

Tomcat Controller

随意将其移至 ServerFault

最佳答案

您安装了两个 JVM。不是启动输出中的 JRE_HOME 行,并将其与上面的 JAVA_HOME 路径进行比较。

您需要更新 JRE_HOME 环境变量和/usr/bin 中的 java 符号链接(symbolic link)以指向 java 7 安装。

关于java - OSX 10.9.1 : "Tomcat started." localhost:8080 says "no data received",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21731754/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com