netbeans 启动Tomcat失败,服务器端口8080已在使用中

taor4pac  于 2022-11-10  发布在  其他
关注(0)|答案(3)|浏览(248)
Deploying on Apache Tomcat or TomEE
    profile mode: false
    debug mode: false
    force redeploy: true
Starting of Tomcat failed, the server port 8080 is already in use.

你好,我有一个基于MVC项目的Spring框架,我正试图建立一个简单的CMS网站。
我昨天在做这个,尽管我在实际运行它时遇到了问题,因为我对整个框架缺乏理解。
但今天我一次又一次地得到同样的消息,即使在尝试了其他开发人员建议的解决方案后,比如通过命令提示符杀死使用该端口的进程,或者简单地更改server.xml文件的端口号,甚至重新启动我的笔记本电脑,这显然不起作用。
我知道我可能会在apache tomcat日志文件中得到一些隐藏的异常消息,但我不确定在哪里查找?
任何帮助都是高度赞赏,因为我坚持与相同的信息和吨的职位,建议相同的事情与不同的变化没有工作到目前为止。
编辑:
以下是完整的Apache Tomcat或TomEE消息:
使用 Catalina 基础:“C:\程序文件\Apache软件基金会\Tomcat 9.0”使用目录主目录:“C:\程序文件\Apache软件基金会\Tomcat 9.0”使用 Catalina TMPDIR:“C:\程序文件\Apache软件基金会\Tomcat 9.0\temp”使用JRE_HOME:
“C:\程序文件\Java\jdk1.8.0_162”使用类路径:
“C:\程序文件\Apache软件基金会\Tomcat 9.0\bin\引导程序. jar; C:\程序文件\Apache软件基金会\Tomcat 9.0\bin\tomcat-juli.jar”2018年7月31日11:33:23.620信息[主要] org.apache.catalina.startup.VersionLoggerListener.log服务器版本:Apache Tomcat/9.0.8 2018年7月31日11:33:23.622信息[主要] org.apache.catalina.startup.VersionLoggerListener.log已建立的服务器:2018年4月27日19:32:00世界协调时2018年7月31日11:33:23.622信息[主要] org.apache.catalina.startup.VersionLoggerListener.log服务器编号:
9.0.8.0 系统名称:apache. catalina. startup. Version LoggerListener.log操作系统名称:
Windows 10 2018年7月31日11:33:23.622信息[主要] org.apache.catalina.startup.VersionLoggerListener.log操作系统版本:
10.0 2018年7月31日11:33:23.622信息[主要] org.apache.catalina.startup.VersionLoggerListener.log架构:
[主目录]. java. apache. catalina. startup. Version LoggerListener.log Java主页:
C:\程序文件\Java\jdk1.8.0_162\jre 2018年7月31日11:33:23.623信息[主要] org.apache.catalina.startup.VersionLoggerListener.log虚拟机版本:1.8.0_162-b12 2018年7月31日11:33:23.623信息[主要] org.apache.catalina.startup.VersionLoggerListener.log虚拟机供应商:
甲骨文公司2018年7月31日11:33:23.624信息[主要] org.apache.catalina.startup.VersionLoggerListener.log目录库:
C:\程序文件\Apache软件基金会\Tomcat 9.0 2018年7月31日11:33:23.624信息[主要] org.apache.catalina.startup.VersionLoggerListener.log目录名:

C:\Program Files\Apache Software Foundation\Tomcat 9.0 31-Jul-2018 11:33:23.624 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties 31-Jul-2018 11:33:23.624 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 31-Jul-2018 11:33:23.624 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|LAPTOP-R1QUMCBE 31-Jul-2018 11:33:23.624 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.16] using APR version [1.6.3]. 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 31-Jul-2018 11:33:23.625 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 31-Jul-2018 11:33:24.339 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2m 2 Nov 2017] 31-Jul-2018 11:33:24.470 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 31-Jul-2018 11:33:24.634 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 31-Jul-2018 11:33:24.642 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 31-Jul-2018 11:33:24.643 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[AJP/1.3-8009]] org.apache.catalina.LifecycleException: Protocol handler initialization failed at org.apache.catalina.connector.Connector.initInternal(Connector.java:935) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:530) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:852) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.startup.Catalina.load(Catalina.java:633) at org.apache.catalina.startup.Catalina.load(Catalina.java:656) 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:306) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491) Caused by: java.net.BindException: Address already in use: bind 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.initServerSocket(NioEndpoint.java:227) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:202) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1043) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:540) at org.apache.catalina.connector.Connector.initInternal(Connector.java:932) ... 13 more

31-Jul-2018 11:33:24.644 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1365 ms 31-Jul-2018 11:33:24.668 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 31-Jul-2018 11:33:24.669 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.8 31-Jul-2018 11:33:24.678 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying deployment descriptor [C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\Catalina\localhost\cms.xml] 31-Jul-2018 11:33:24.699 WARNING [main] org.apache.catalina.startup.HostConfig.deployDescriptor The path attribute with value [/cms] in deployment descriptor [C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\Catalina\localhost\cms.xml] has been ignored 31-Jul-2018 11:33:26.752 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 31-Jul-2018 11:33:28.344 INFO [main] org.hibernate.jpa.internal.util.LogHelper.logPersistenceUnitInformation HHH000204: Processing PersistenceUnitInfo [ name: cms ...] 31-Jul-2018 11:33:28.522 INFO [main] org.hibernate.Version.logVersion HHH000412: Hibernate Core {5.2.9.Final} 31-Jul-2018 11:33:28.525 INFO [main] org.hibernate.cfg.Environment. HHH000206: hibernate.properties not found 31-Jul-2018 11:33:28.606 INFO [main] org.hibernate.annotations.common.reflection.java.JavaReflectionManager. HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 31-Jul-2018 11:33:28.850 INFO [main] org.hibernate.dialect.Dialect. HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 31-Jul-2018 11:33:30.808 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file 31-Jul-2018 11:33:30.810 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Context [/cms] startup failed due to previous errors 31-Jul-2018 11:33:30.823 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [cms] registered the JDBC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 31-Jul-2018 11:33:30.829 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of deployment descriptor [C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\Catalina\localhost\cms.xml] has finished in [6,151] ms 31-Jul-2018 11:33:30.832 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 31-Jul-2018 11:33:30.842 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 6197 ms
I see this:
Caused by: java.net.BindException: Address already in use: bind
OK, I get it but I tried killed the processes that use it still nothing, I'm going to try with TCPView

**EDIT:**This was when I was trying to use NetBeans, once I started using STS I don't have any problems with tomcat.

fcy6dtqo

fcy6dtqo1#

尝试列出所有应用程序及其端口,并检查使用8080的应用程序,然后尝试杀死它,或者您可以直接杀死使用该端口的任何应用程序
第二个选项是将tomcat服务器的端口更改为任何可用的端口
我希望这能解决你的问题

8fsztsew

8fsztsew2#

我相信Tomcat在使用netbeans和某些java版本时会产生bug。我也遇到过同样的问题。在经历了许多头痛之后,我的解决方案是在netbeans上进入我的tomcat服务器,进入tomcat属性,平台,并选择一个不同的Java平台选项(java 11给了我这个问题,而1. 8工作得很好)。
让我知道你的情况c:

juud5qan

juud5qan3#

在Tomcat的后续启动之间,端口很可能处于关闭状态。
www.example.com上@BillThor的回答superuser.com解释了端口的关闭状态:
https://superuser.com/a/173542/596755
由于TCP/IP的工作方式,连接不能立即关闭。数据包可能会无序到达,或者在连接关闭后重新传输。

CLOSE_WAIT indicates that the remote endpoint (other side of the connection) has closed the connection.
TIME_WAIT indicates that local endpoint (this side) has closed the connection.

连接被保留,以便任何延迟的数据包都可以与连接匹配并得到适当处理。连接在四分钟内超时时将被删除。有关详细信息,请参阅http://en.wikipedia.org/wiki/Transmission_Control_Protocol
要解决此问题,Tomcat需要使用reuseAddress=true
配置中的连接器部分应具有以下属性:socket.soReuseAddress="true"
示例:

<Connector port="8080" protocol="HTTP/1.1" socket.soReuseAddress="true" />

相关问题