tomcat7安装报错

Installation error in tomcat7

当我尝试在 ubuntu 15.10 上安装 tomcat 7 时,它显示以下错误。我重新安装 tomcat7 超过三次,但它仍然显示相同的错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  authbind libcommons-collections3-java libcommons-dbcp-java
  libcommons-pool-java libecj-java libservlet3.0-java libtomcat7-java
  tomcat7-common
Suggested packages:
  libcommons-collections3-java-doc libcommons-dbcp-java-doc
  libgeronimo-jta-1.1-spec-java ecj ant libecj-java-gcj tomcat7-docs
  tomcat7-admin tomcat7-examples tomcat7-user libtcnative-1
The following NEW packages will be installed:
  authbind libcommons-collections3-java libcommons-dbcp-java
  libcommons-pool-java libecj-java libservlet3.0-java libtomcat7-java tomcat7
  tomcat7-common
0 upgraded, 9 newly installed, 0 to remove and 244 not upgraded.
Need to get 0 B/6,782 kB of archives.
After this operation, 8,286 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libcommons-collections3-java.
(Reading database ... 208809 files and directories currently installed.)


   Preparing to unpack .../libcommons-collections3-java_3.2.1-8_all.deb ...
    Unpacking libcommons-collections3-java (3.2.1-8) ...
    Selecting previously unselected package libcommons-pool-java.
    Preparing to unpack .../libcommons-pool-java_1.6-2_all.deb ...
    Unpacking libcommons-pool-java (1.6-2) ...
    Selecting previously unselected package libcommons-dbcp-java.
    Preparing to unpack .../libcommons-dbcp-java_1.4-5ubuntu1_all.deb ...
    Unpacking libcommons-dbcp-java (1.4-5ubuntu1) ...
    Selecting previously unselected package libecj-java.
    Preparing to unpack .../libecj-java_3.10.1-2_all.deb ...
    Unpacking libecj-java (3.10.1-2) ...
    Selecting previously unselected package libservlet3.0-java.
    Preparing to unpack .../libservlet3.0-java_7.0.64-1_all.deb ...
    Unpacking libservlet3.0-java (7.0.64-1) ...
    Selecting previously unselected package libtomcat7-java.
    Preparing to unpack .../libtomcat7-java_7.0.64-1_all.deb ...
    Unpacking libtomcat7-java (7.0.64-1) ...
    Selecting previously unselected package tomcat7-common.
    Preparing to unpack .../tomcat7-common_7.0.64-1_all.deb ...
    Unpacking tomcat7-common (7.0.64-1) ...
    Selecting previously unselected package tomcat7.
    Preparing to unpack .../tomcat7_7.0.64-1_all.deb ...
    Unpacking tomcat7 (7.0.64-1) ...
    Selecting previously unselected package authbind.
    Preparing to unpack .../authbind_2.1.1+nmu1_amd64.deb ...
    Unpacking authbind (2.1.1+nmu1) ...
    Processing triggers for ureadahead (0.100.0-19) ...
    ureadahead will be reprofiled on next reboot
    Processing triggers for systemd (225-1ubuntu9) ...
    Processing triggers for man-db (2.7.4-1) ...
    Setting up libcommons-collections3-java (3.2.1-8) ...
    Setting up libcommons-pool-java (1.6-2) ...
    Setting up libcommons-dbcp-java (1.4-5ubuntu1) ...
    Setting up libecj-java (3.10.1-2) ...
    Setting up libservlet3.0-java (7.0.64-1) ...
    Setting up libtomcat7-java (7.0.64-1) ...
    Setting up tomcat7-common (7.0.64-1) ...
    Setting up tomcat7 (7.0.64-1) ...


    * Starting Tomcat servlet engine tomcat7                                       cat: /var/lib/tomcat7/conf/policy.d/*.policy: No such file or directory
    invoke-rc.d: initscript tomcat7, action "start" failed.
    dpkg: error processing package tomcat7 (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up authbind (2.1.1+nmu1) ...
    Errors were encountered while processing:
     tomcat7
    E: Sub-process /usr/bin/dpkg returned an error code (1)

请谁帮我安装tomcat7.

您的包管理器似乎有问题,这可能是因为源已损坏。你能安装其他包吗?你 运行 到底是哪种 OS?

uname -a 

你也可以尝试运行这个:

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

dist 升级后,我建议您重新启动服务器。重启后尝试 运行sudo apt-get install tomcat7

祝你好运!

我遇到了同样的问题,我的错是安装了 openjdk9。我删除了所有内容,然后清除并 -f 安装。清理后,只需使用 sudo apt-get install 安装 tomcat7,他就得到了他需要的一切

  sudo apt-get remove openjdk*
  sudo apt-get purge openjdk*
  sudo apt-get autoremove
  sudo apt-get -f install
  sudo apt-get install tomcat7

遇到了同样的问题并找到了一个简单的解决方案。发生这种情况是因为新安装的 tomcat 无法找到 JAVA_HOME。只需转到 /etc/default/tomcat7,取消注释 JAVA_HOME 变量并提供正确的路径到您安装的 java 目录。

这将解决问题。