【问题标题】:After running Spring boot app with 'webapp-runner' it's stoping on a line "INFO: Starting ProtocolHandler ["http-nio-8080"]"使用“webapp-runner”运行 Spring boot 应用程序后,它停止在“INFO:启动 ProtocolHandler [”http-nio-8080“]”行
【发布时间】:2019-08-29 20:26:31
【问题描述】:

我需要将 applocation 部署到 heroku,它是用 Spring Boot 创建的,因此我已经添加了一个 webapp-runner.jar 插件,现在它无法在 Heroku 上运行,我在本地机器上运行如果我使用 webapp-runner.jar 从 cmd 运行它,我会遇到同样的问题。

现在我使用的是 runner 9.0.24.0 版本,之前我尝试在版本 8 中运行它...

这是我在 pom.xml 中的插件

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <goals><goal>copy</goal></goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.github.jsimone</groupId>
                  <artifactId>webapp-runner</artifactId>
                  <version>9.0.24.0</version>
                  <destFileName>webapp-runner.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

那是我的 Procfile

web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

这是我的 cmd 日志

авг 29, 2019 11:09:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
авг 29, 2019 11:09:48 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
авг 29, 2019 11:09:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.24]
авг 29, 2019 11:09:49 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
авг 29, 2019 11:10:04 PM org.apache.catalina.core.ApplicationContext log
INFO: 1 Spring WebApplicationInitializers detected on classpath
авг 29, 2019 11:10:05 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
авг 29, 2019 11:10:05 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [241] milliseconds.
авг 29, 2019 11:10:05 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]

它应该使用 Procfile 中的命令来运行它,就像在本地机器和 Heroku 中一样。我该如何解决这个问题?

【问题讨论】:

    标签: java spring spring-boot tomcat heroku


    【解决方案1】:

    这篇文章在过去帮助了我很多,也可能对你有用。

    • 将目录更改为安装 Tomcat 的位置,然后转到 bin
    • 使用您喜欢的任何编辑器打开catalina.sh 文件,例如nanovim
    • 查找JAVA_OPTS 并添加这一行:

    -Djava.security.egd=file:/dev/./urandom

    来源:https://geekflare.com/tomcat-stuck-at-startup/

    【讨论】:

    • 但我没有使用 Tomcat 独立网络服务器,我在 pom.xml 中使用 webapp-runner 插件。
    猜你喜欢
    • 2017-04-14
    • 2012-09-29
    • 1970-01-01
    • 2020-06-30
    • 1970-01-01
    • 2018-03-18
    • 1970-01-01
    • 1970-01-01
    • 2014-03-25
    相关资源
    最近更新 更多