Tomcat启动失败(端口198被占用)求助:NetBeans运行Java Web程序遇问题
Hey there, I’ve run into this exact port conflict issue plenty of times—let’s get your Tomcat up and running again with these straightforward solutions:
1. Kill the process using port 198
The quickest fix is to shut down whatever’s hogging port 198. Here’s how to do it on different systems:
Windows
- Open Command Prompt as administrator, then run:
This will show you the PID (process ID) of the program using the port.netstat -ano | findstr :198 - Next, kill that process with:
Replacetaskkill /F /PID <your-PID-number><your-PID-number>with the number you found in the previous step.
Linux/macOS
- Open Terminal and run:
Or iflsof -i :198lsofisn’t installed, use:netstat -tulpn | grep :198 - Once you have the PID, terminate the process:
sudo kill -9 <your-PID-number>
2. Change Tomcat’s port number
If you don’t want to kill the existing process, just switch Tomcat to use a different port:
Option 1: Edit via Tomcat’s config file
Navigate to your Tomcat installation directory, go to theconffolder, and openserver.xmlin a text editor. Look for the<Connector>tag that hasport="198"—it’ll look something like this:<Connector port="198" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>Change the
portvalue to an unused number (like 8081, 9090, etc.), save the file, then restart Tomcat from NetBeans.Option 2: Update via NetBeans server settings
In NetBeans, go toTools > Servers, select your Tomcat server from the list. Click theConnectiontab, then modify the "HTTP Port" field to your desired unused port. Save the changes and restart the server.
3. Double-check for conflicting services
Sometimes other apps (like another Tomcat instance, a proxy server, or even some background tools) might be using port 198. Quickly check if you have any other servers running in NetBeans or on your system that could be causing this overlap.
After trying any of these steps, restart your Tomcat server in NetBeans—it should start up without the port conflict error!
内容的提问来源于stack exchange,提问作者Pankaj Yadav

