2014-10-30 142 views
1

突然間我不能啓動我的嵌入式tomcat。不能啓動tomcat與Linux上的彈簧啓動

我得到:

[main] ERROR o.a.coyote.http11.Http11NioProtocol - Failed to start end point associated with ProtocolHandler ["http-nio-86"] 
java.net.SocketException: Permission denied 

我試圖改變tomcat的端口, 我嘗試設置權限:chmod 777 SRC/-R

我使用Linux Mint的17

我不知道是什麼要做...

這是堆棧跟蹤:

[main] ERROR o.a.coyote.http11.Http11NioProtocol - Failed to start end point associated with ProtocolHandler ["http-nio-86"] 
java.net.SocketException: Permission denied 
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_67] 
    at sun.nio.ch.Net.bind(Net.java:444) ~[na:1.7.0_67] 
    at sun.nio.ch.Net.bind(Net.java:436) ~[na:1.7.0_67] 
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) ~[na:1.7.0_67] 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_67] 
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:647) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1007) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:459) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:79) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:69) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:270) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:145) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:159) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476) [spring-context-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at com.company.WebApplication.main(WebApplication.java:23) [classes/:na] 
- 2014-10-30 10:30:51,609 [main] ERROR o.a.catalina.core.StandardService - Failed to start connector [Connector[org.apache.coyote.http11.Http11NioProtocol-86]] 
org.apache.catalina.LifecycleException: Failed to start component [Connector[org.apache.coyote.http11.Http11NioProtocol-86]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:459) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:79) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:69) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:270) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:145) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:159) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476) [spring-context-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898) [spring-boot-1.0.2.RELEASE.jar:1.0.2.RELEASE] 
    at com.company.WebApplication.main(WebApplication.java:23) [classes/:na] 
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed 
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1014) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.52.jar:7.0.52] 
    ... 18 common frames omitted 
Caused by: java.net.SocketException: Permission denied 
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_67] 
    at sun.nio.ch.Net.bind(Net.java:444) ~[na:1.7.0_67] 
    at sun.nio.ch.Net.bind(Net.java:436) ~[na:1.7.0_67] 
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) ~[na:1.7.0_67] 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_67] 
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:647) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1007) ~[tomcat-embed-core-7.0.52.jar:7.0.52] 
    ... 19 common frames omitted 
- 2014-10-30 10:30:51,609 [main] INFO o.a.coyote.http11.Http11NioProtocol - Stopping ProtocolHandler ["http-nio-86"] 
- 2014-10-30 10:30:51,609 [main] INFO o.a.coyote.http11.Http11NioProtocol - Pausing ProtocolHandler ["http-nio-86"] 
- 2014-10-30 10:30:51,609 [main] INFO o.a.catalina.core.StandardService - Stopping service Tomcat 
- 2014-10-30 10:30:51,612 [localhost-startStop-1] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. 
- 2014-10-30 10:30:51,612 [localhost-startStop-1] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. 
- 2014-10-30 10:30:51,612 [localhost-startStop-1] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has failed to stop it. This is very likely to create a memory leak. 
- 2014-10-30 10:30:51,613 [localhost-startStop-1] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has failed to stop it. This is very likely to create a memory leak. 
- 2014-10-30 10:30:51,613 [localhost-startStop-1] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. 
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:135) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476) 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898) 
    at com.company.WebApplication.main(WebApplication.java:23) 
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:106) 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:69) 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:270) 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:145) 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:159) 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132) 
    ... 7 more 
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state 
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:102) 
    ... 12 more 

請幫幫我。

+0

你有本地的tomcat安裝嗎,還是通過mvn tomcat7運行tomcat:運行? – user 2014-10-30 08:41:17

+0

我不知道,但它嵌入了彈簧引導,所以我認爲它使用mvn。 我不自己運行一個tomcat,我不使用eclipse來啓動和停止它。 – 2014-10-30 08:43:31

回答

6

Linux不允許普通用戶綁定到< = 1024的TCP端口。有關於該原因的討論here。你試圖綁定到86,因此,它沒有「權限被拒絕」。最快和最安全的解決方案是配置端口的值大於1024.

當您使用Boot的嵌入式Tomcat實例時,使用server.port屬性在application.properties中配置端口。