Openshift在线v3启动错误

时间:2017-09-30 13:37:42

标签: java tomcat openshift

我正在将我的应用程序从openshift online 2迁移到3.此应用程序是一个tomcat war aplication,并依赖server.xml来加载配置。我已经放入了gihub配置文件夹,但是当应用程序部署时出现以下错误:

org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-auto-1]]
    at org.apache.catalina.util.LifecycleBase.start(Unknown Source)
    at org.apache.catalina.core.StandardService.startInternal(Unknown Source)
    at org.apache.catalina.util.LifecycleBase.start(Unknown Source)
    at org.apache.catalina.core.StandardServer.startInternal(Unknown Source)
    at org.apache.catalina.util.LifecycleBase.start(Unknown Source)
    at org.apache.catalina.startup.Catalina.start(Unknown Source)
    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:498)
    at org.apache.catalina.startup.Bootstrap.start(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: The connector cannot start since the specified port value of [-1] is invalid
    at org.apache.catalina.connector.Connector.startInternal(Unknown Source)
    ... 12 more

server.xml是:

<Server port="-1" shutdown="SHUTDOWN">  
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">  
    <Connector address="${OPENSHIFT_JBOSSEWS_IP}"
               port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}"
               protocol="HTTP/1.1"
               connectionTimeout="200000"
               redirectPort="8443"/>

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="false" autoDeploy="true">  
      <Valve
          className="org.apache.catalina.valves.RemoteIpValve"
          protocolHeader="x-forwarded-proto"
        />

  <Valve 
    className="org.apache.catalina.valves.StuckThreadDetectionValve"
    threshold="60" />

      </Host>
    </Engine>
  </Service>
</Server>

我将环境变量OPENSHIFT_JBOSSEWS_IP添加到0.0.0.0和OPENSHIFT_JBOSSEWS_HTTP_PORT 8080。

我错过了什么或做错了什么?

谢谢

1 个答案:

答案 0 :(得分:0)

我已经弄清楚了(在openshift支持的帮助下)。所以我的错误是 而是使用

<Server port="-1" shutdown="SHUTDOWN">  

我应该

<Server port="8005" shutdown="SHUTDOWN">  

并配置所有openshift环境变量