无法从webbrowser访问tomcat

时间:2018-01-18 14:22:46

标签: tomcat

我在服务器上安装了tomcat9,但我无法从webbrowser访问它。 它说连接被拒绝了。

This site can’t be reached
localhost refused to connect.
Search Google for localhost 8081
ERR_CONNECTION_REFUSED

我尝试在server.xml文件中将默认端口8080更改为8081但它似乎不起作用。 我尝试使用端口8080检查任何其他实例,但这也无法解决问题。 这就是我在catalina日志中看到的

18-Jan-2018 19:26:53.567 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[AJP/1.3-8009]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8009]]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:113)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
        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:498)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:947)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        ... 12 more
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:229)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:866)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:575)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:944)
        ... 13 more

我还能在这里查看什么?

1 个答案:

答案 0 :(得分:0)

原因是

Caused by: java.net.BindException: Address already in use

在您的localhost上,端口8080当前正在运行一个应用程序。可能是Web服务器的任何实例。您可以使用

在Linux / Unix上进行检查
  

netstat -lnp

在您将找到端口8080的行中,有一个占用此端口的进程号。终止此过程并启动服务器