如何修复'无法初始化与ProtocolHandler相关的终点'错误?

时间:2013-01-20 19:09:42

标签: ubuntu tomcat7

我已经在我的Ubuntu 12.04中安装了Tomcat 7。

不知何故Tomcat没有开始。尝试了所有可能的步骤,检查了论坛;没什么帮助。

谁能告诉我出了什么问题?

从我的电脑上登录,获取命令:

~$ sh  /usr/share/tomcat7/bin/catalina.sh run

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.

提前感谢。

从下面编辑。

重新安装Tomcat7。

这次缺少的“server.xml”文件位于路径:/usr/share/tomcat7/skel/conf/server.xml

再次尝试:

~$ sh  /usr/share/tomcat7/bin/catalina.sh run

日志在下面。

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.

从下面编辑。

强行尝试取消警告

现在我已经执行了以下操作:

  1. 获取bash身份验证传递:

    ~$ sudo bash
    
  2. 在/ usr / share / tomcat7 / skel

    创建一个临时目录
    ~# mkdir /usr/share/tomcat7/skel/temp
    
  3. 告诉Tomcat7我的conf / server.xml位于哪里

    ~# export CATALINA_BASE=/usr/share/tomcat7/skel
    
  4. 运行Catalina.sh

    ~# sh  /usr/share/tomcat7/bin/catalina.sh run
    
  5. 日志:

    Using CATALINA_BASE:   /usr/share/tomcat7/skel
    Using CATALINA_HOME:   /usr/share/tomcat7
    Using CATALINA_TMPDIR: /usr/share/tomcat7/skel/temp
    Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
    Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
    21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol init
    SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
    java.net.BindException: Address already in use <null>:8080
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:391)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:554)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)
        at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:815)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:594)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:619)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)
    Caused by: java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
        at java.net.ServerSocket.bind(ServerSocket.java:336)
        at java.net.ServerSocket.<init>(ServerSocket.java:202)
        at java.net.ServerSocket.<init>(ServerSocket.java:158)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)
        ... 17 more
    21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService initInternal
    SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]]
    org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8080]]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:815)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:594)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:619)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)
    Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:958)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        ... 12 more
    Caused by: java.net.BindException: Address already in use <null>:8080
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:391)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:554)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)
        at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
        ... 13 more
    Caused by: java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
        at java.net.ServerSocket.bind(ServerSocket.java:336)
        at java.net.ServerSocket.<init>(ServerSocket.java:202)
        at java.net.ServerSocket.<init>(ServerSocket.java:158)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)
        ... 17 more
    21 Jan, 2013 4:04:57 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 811 ms
    21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
    21 Jan, 2013 4:04:57 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 37 ms
    21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardServer await
    SEVERE: StandardServer.await: create[localhost:8005]: 
    java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
        at java.net.ServerSocket.bind(ServerSocket.java:336)
        at java.net.ServerSocket.<init>(ServerSocket.java:202)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:727)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:673)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
    21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler ["http-bio-8080"]
    21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService stopInternal
    INFO: Stopping service Catalina
    21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol stop
    INFO: Stopping ProtocolHandler ["http-bio-8080"]
    21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler ["http-bio-8080"]
    

    虽然存在SEVERE消息日志,但是当我在浏览器中测试http:// localhost:8080时,我看到 它有效!

    需要专家建议:我应该继续我在Tomcat7上的工作还是需要整理的东西。

6 个答案:

答案 0 :(得分:2)

我已经通过apt-get在Linux Mint 17 Qiana上安装了tomcat7并使用以下方法解决了某些相同的问题:

cd /usr/share/tomcat7
ln -s /etc/tomcat7 conf
chmod -R 655 /etc/tomcat7/

more info

答案 1 :(得分:1)

以下例外情况已经说明:

Caused by: java.net.BindException: Address already in use <null>:8080

您在本地计算机上启动了另一台不允许Tomcat 7启动的服务器。 “It Works”消息与Tomcat7无关,而应该看到Tomcat管理器(带有Tomcat徽标)出现。

停止在本地运行的任何HTTP服务器并重新启动Tomcat7。

答案 2 :(得分:1)

异常是错误消息中的状态

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080 

您有另一个服务器实例在同一台计算机上运行的任何其他进程,因此您不允许使用相同的端口,因此您需要先停止正在运行的实例或更改当前的tomcat端口号。

您可以将正在运行的实例停止为

ps ax | grep java  //lists all java processes

然后通过

杀死进程
sudo kill -9 pid  //pid-process id

答案 3 :(得分:1)

通过重新安装从新下载解决问题(下载了* tar.gz压缩版本)。

答案 4 :(得分:0)

正如Buhake Sindi指出的那样,“它有效!”消息不是Tomcat。为了将来参考,该特定消息来自Apache httpd。

在尝试启动Tomcat7之前尝试运行service apache2 stop。我认为这是端口8080锁的最可能的罪魁祸首。

答案 5 :(得分:0)

其中一些问题,例如&#34;缺少&#34; server.xml&#34;等等可以通过符号链接来解决

cd /usr/share/tomcat7
ln -s /etc/tomcat7 conf

在修好类似的东西后,这对我有用,所以我的意思是要照顾这些链接。

我希望它会有用

我的配置是Linux Mint 16,tomcat7是通过apt-get