当前位置: 代码迷 >> java >> 为什么TomCat 8无法在我的Ubuntu 15.04系统上工作?
  详细解决方案

为什么TomCat 8无法在我的Ubuntu 15.04系统上工作?

热度:105   发布时间:2023-07-26 14:50:35.0

我已经使用以下命令在Ubuntu 15.04系统上安装了TomCat 8

sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples

因此,我的安装目录为:

/usr/share/tomcat8/bin

因此,我输入此目录,然后执行以下命令来启动服务器:

sudo ./startup.sh

我得到这个:

andrea@andrea-virtual-machine:/usr/share/tomcat8/bin$ sudo ./startup.sh 
Using CATALINA_BASE:   /usr/share/tomcat8
Using CATALINA_HOME:   /usr/share/tomcat8
Using CATALINA_TMPDIR: /usr/share/tomcat8/temp
Using JRE_HOME:        /usr/lib/jvm/java-8-oracle
Using CLASSPATH:       /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar
Tomcat started.

因此,我认为服务器已启动。

问题是,如果我尝试在浏览器中打开此URL ,则会错误消息: 连接失败 (我不知道这是正确的英语翻译,因为我看到的是意大利语语言)。

如果尝试打开此URL **** **(没有8080端口规范),则会获得Apache 2 Web服务器信息页面(我将其用于某些PHP网站)。

如果我尝试执行TomCat关闭, 则会收到以下错误消息:

andrea@andrea-virtual-machine:/usr/share/tomcat8/bin$ sudo ./shutdown.sh
Using CATALINA_BASE:   /usr/share/tomcat8
Using CATALINA_HOME:   /usr/share/tomcat8
Using CATALINA_TMPDIR: /usr/share/tomcat8/temp
Using JRE_HOME:        /usr/lib/jvm/java-8-oracle
Using CLASSPATH:       /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/common/classes], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/common], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/server/classes], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/server], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/usr/share/tomcat8/shared], exists: [false], isDirectory: [false], canRead: [false]
lug 16, 2015 2:13:35 PM org.apache.catalina.startup.Catalina stopServer
GRAVE: Catalina.stop: 
java.io.FileNotFoundException: /usr/share/tomcat8/conf/server.xml (File o directory non esistente)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:427)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:400)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:487)

那么可能是什么问题呢? 我想念什么? 我该如何解决?

特纳克斯

当您使用apt在Ubuntu中安装Tomcat时,它将作为服务安装。 要启动和停止它,您应该使用以下命令:

sudo service tomcat8 start
sudo service tomcat8 stop

您还可以使用以下命令查看其当前状态:

sudo service tomcat8 status

在尝试此操作之前,您可能需要重新启动,以确保您没有在后台运行任何其他Tomcat进程。

  相关解决方案