之前都是用Tomcat这个容器,后来做的项目需要用到Jetty,于是就在IDEA上配置了Jetty,但是后来我发现Jetty并不像我以往使用Tomcat时可以配置多个端口用来部署不同的项目。
IDEA启动Jetty时首先会检测8080的端口①(Detected server http port: 8080),所以当你需要配置多个端口的jetty时,要保证8080端口没有被占用,否则会提示端口被占用。

在配置Jetty的时候在VM options一栏里填-Djetty.port=8090(8090为你要设置的端口号);在JMX port 要使用其他没有使用过的端口号就行;
最后点击Apply

①上面说的启动Jetty的时候,会检测8080端口。所以你要开多个Jetty的时候即使用多个端口时,你要保证8080端口没有被占用。
网友评论