I can't start tomcat 7 server on linux openshift - Failed to start end point associated with ProtocolHandler [“http-nio-12345”]

匿名 (未验证) 提交于 2019-12-03 00:45:01

问题:

I've checked out this question which is very similar to mine, however the difference is I'm using a port > 1024 (i.e. I'm using port 12345) which is what the answerer said to do. I'm trying to run a Tomcat instance on an Openshift server.. Any help is appreciated! Thanks!

My execution script is as follows:

nohup java -Xms384m -Xmx412m -jar target/*.war --server.port=12345 

Note the "-jar" is this right? I am deploying a .war file not a .jar? I think.. Sorry, a little new to this.

The important part of my error output is as follows:

2015-10-07 19:30:13.317 INFO 261765 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2015-10-07 19:30:13.409 DEBUG 261765 --- [
main] o.s.w.s.resource.ResourceUrlProvider : Looking for resource handler mappings 2015-10-07 19:30:13.411 DEBUG 261765 --- [
main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@f5e53a1] 2015-10-07 19:30:13.412 DEBUG 261765 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@1f5137b7] 2015-10-07 19:30:13.414 DEBUG 261765 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@3f8892d1] 2015-10-07 19:30:14.022 ERROR 261765 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-12345"]

java.net.SocketException: Permission denied at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.Net.bind(Net.java:428) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449) at org.apache.catalina.connector.Connector.startInternal(Connector.java:1007) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:241) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186) at ...

application.properties:

logging.level.org.springframework.web=DEBUG

logging.level.org.hibernate=ERROR

error.whitelabel.enabled=false

server.port=12345

web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"          version="2.5">      <display-name>Demo Web Application</display-name>      <servlet>         <servlet-name>mvc-dispatcher</servlet-name>         <servlet-class>             org.springframework.web.servlet.DispatcherServlet         </servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>      <servlet-mapping>         <servlet-name>mvc-dispatcher</servlet-name>         <!--<url-pattern>/</url-pattern>-->         <url-pattern>*.html</url-pattern>     </servlet-mapping>      <context-param>         <param-name>contextConfigLocation</param-name>         <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>     </context-param>      <welcome-file-list>         <welcome-file>index.html</welcome-file>     </welcome-file-list> </web-app> 

mvc-dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xmlns:mvc="http://www.springframework.org/schema/mvc"        xsi:schemaLocation="http://www.springframework.org/schema/beans                            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd                            http://www.springframework.org/schema/mvc                            http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">      <mvc:annotation-driven /> </beans> 

And finally...

Application.java

package hello;  import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;  import java.util.List;  @RestController @SpringBootApplication public class Application extends SpringBootServletInitializer {     @Autowired     UserRepository userRepository;      @RequestMapping ("/isRunning")     boolean isRunning () {         return true;     }      @RequestMapping ("/")     String home () {         return "Home";     }      @Override     protected SpringApplicationBuilder configure (SpringApplicationBuilder application) {         return application.sources(Application.class);     }      public static void main (String[] args) {         SpringApplication.run(Application.class);         System.out.println("RUNNING! :D");     } } 

And finally...

pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">     <modelVersion>4.0.0</modelVersion>      <packaging>war</packaging>      <groupId>org.springframework</groupId>     <artifactId>gs-crud-with-vaadin</artifactId>     <version>0.1.0</version>      <parent>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-parent</artifactId>         <version>1.2.6.RELEASE</version>     </parent>      <properties>         <java.version>1.7</java.version>         <tomcat.version>7.0.59</tomcat.version>     </properties>      <dependencies>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-data-jpa</artifactId>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-log4j</artifactId>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-web</artifactId>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-tomcat</artifactId>             <scope>provided</scope>         </dependency>         <dependency>             <groupId>com.h2database</groupId>             <artifactId>h2</artifactId>         </dependency>     </dependencies>      <build>         <plugins>             <plugin>                 <groupId>org.springframework.boot</groupId>                 <artifactId>spring-boot-maven-plugin</artifactId>             </plugin>         </plugins>     </build> </project> 

UPDATE 1

Okay, so I ran rhc app-tidy -a {APP_NAME} and it now deploys fine and launched and works fine but I am still having the same error log output... Why is this? What's wrong?

2015-10-08 03:15:41.254 ERROR 290379 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-8080"]

java.net.SocketException: Permission denied at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.Net.bind(Net.java:428) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449) at org.apache.catalina.connector.Connector.startInternal(Connector.java:1007) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:241) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) at hello.Application.main(Application.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) at java.lang.Thread.run(Thread.java:745)

2015-10-08 03:15:41.263 ERROR 290379 --- [ main] o.apache.catalina.core.StandardService : Failed to start connector [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]

org.apache.catalina.LifecycleException: Failed to start component [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:241) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) at hello.Application.main(Application.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:1014) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 18 common frames omitted Caused by: java.net.SocketException: Permission denied at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.Net.bind(Net.java:428) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449) at org.apache.catalina.connector.Connector.startInternal(Connector.java:1007) ... 19 common frames omitted

2015-10-08 03:15:41.347 INFO 290379 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2015-10-08 03:15:41.682 INFO 290379 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/classes!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-data-jpa-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-autoconfigure-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-logging-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/log4j-over-slf4j-1.7.12.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/logback-classic-1.1.3.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/logback-core-1.1.3.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/snakeyaml-1.14.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-aop-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aopalliance-1.0.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aspectjrt-1.8.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aspectjweaver-1.8.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-jdbc-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/tomcat-jdbc-7.0.59.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/tomcat-juli-7.0.59.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-entitymanager-4.3.11.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jboss-logging-annotations-1.2.0.Beta1.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-core-4.3.11.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/antlr-2.7.7.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jandex-1.1.0.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/dom4j-1.6.1.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/xml-apis-1.0.b2.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-commons-annotations-4.0.5.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/javassist-3.18.1-GA.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/javax.transaction-api-1.2.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-orm-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-data-jpa-1.7.3.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-data-commons-1.9.3.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/slf4j-api-1.7.12.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-aspects-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-log4j-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jcl-over-slf4j-1.7.12.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jul-to-slf4j-1.7.12.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/log4j-1.2.17.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-web-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-databind-2.4.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-annotations-2.4.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-core-2.4.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-validator-5.1.3.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/validation-api-1.1.0.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/classmate-1.0.0.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/h2-1.4.188.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/spring-boot-starter-tomcat-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-core-7.0.59.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-el-7.0.59.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-logging-juli-7.0.59.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-websocket-7.0.59.jar!/] 2015-10-08 03:15:41.683 INFO 290379 --- [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)

2015-10-08 03:15:41.724 ERROR 290379 --- [ main] o.s.boot.SpringApplication : Application startup failed

java.lang.IllegalStateException: Tomcat connector in failed state at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) at hello.Application.main(Application.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) at java.lang.Thread.run(Thread.java:745)

2015-10-08 03:15:41.724 INFO 290379 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7c2b6a03: startup date [Thu Oct 08 03:14:59 EDT 2015]; root of context hierarchy 2015-10-08 03:15:41.739 INFO 290379 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2015-10-08 03:15:41.777 INFO 290379 --- [
main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: Tomcat connector in failed state at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) at hello.Application.main(Application.java:41) ... 6 more Starting jbossews cartridge Found 127.7.143.1:8080 listening port Archiving artifacts Unable to auto-install JDK until the license is accepted. Finished: SUCCESS

回答1:

As described here, OpenShift restricts the ports that an application can bind to. You can use 15000 - 35530 to bind an internal IP. You can also use 8080, and must do so if you want your Spring Boot app to be externally accessible.

You also need to bind to the correct address. There's an example showing how to configure the address and port using OpenShift's environment variables in the Spring Boot documentation:

nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} & 


回答2:

So, the exception that was being thrown should have been a StupidDeveloperException. Anyway, I had already started tomcat on that port and wasn't stopping it before trying to bind it again to the same port, resulting in that error. Thanks guys for all your input!



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!