Answer the question
In order to leave comments, you need to log in
Two processes are listening on the same port, how is that possible?
Windows 8.1 Pro
Launched and running tomcat (7.0.72.0 JVM 1.7.0_13-b20) on port 8080
Launched HelloWorld example on jetty
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
public class WebServer extends AbstractHandler {
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");
}
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
server.setHandler(new WebServer());
server.start();
server.join();
}
}
2017-02-01 12:21:02.029:INFO::main: Logging initialized @
132ms
01 12:21:02.116:INFO:oejs.ServerConnector:main: Started [email protected]{HTTP/1.1}{0.0.0.0:8080}
2017-02-01 12:21:02.117:INFO:oejs.Server:main: Started @222ms
D:\>netstat -ano|find /i "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 5536
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2464
TCP [::]:8080 [:: ]:0 LISTENING 5536
D:\>tasklist|find /i "tom"
tomcat7.exe 2464 Services 0 185916 KB
D:\>tasklist|find /i "java"
javaw.exe 5536 Console 1 26864 KB
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question