我正在研究一些Spring MVC示例,并使用Jetty jetty-9.1.1.v20140108作为我的开发服务器。我有另一台服务器,JBOSS 5.1.0监听端口8080,所以我试图为Jetty指定一个备用端口,但是,它似乎并没有“坚持”。我在这里做错了什么?
$ java -Djetty.port=9000 -jar start.jar
...
INFO: FrameworkServlet 'spring-example': initialization completed in 142 ms
2014-02-05 17:27:50.369:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@45ad71f0{/spring-example,file:/tmp/jetty-0.0.0.0-8080-spring-example.war-_spring-example-any-1672792505692467455.dir/webapp/,AVAILABLE}{/spring-example.war}
2014-02-05 17:27:50.374:WARN:oejuc.AbstractLifeCycle:main: FAILED ServerConnector@228643af{HTTP/1.1}{0.0.0.0:8080}: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:279)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
...
也许还有另一个端口设置优先,但我认为命令行将胜过所有。如何正确设置端口?
答案 0 :(得分:1)
根据文档,您将port设置为应用程序参数而不是系统属性:http://www.eclipse.org/jetty/documentation/current/quickstart-running-jetty.html
java -jar start.jar jetty.port = 9000