gpt4 book ai didi

java - 将 java web 应用程序部署到 Heroku 时遇到问题

转载 作者:行者123 更新时间:2023-11-30 06:59:16 25 4
gpt4 key购买 nike

我已经尝试将我的 java 应用程序部署到 Heroku 两天了。我所做的一切都与人们在他们的教程中所做的相同。但有些不对劲。怎么解决?

这里是heroku应用程序日志

2016-12-18T19:07:22.740701+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -cp target/dependency/jetty-runner.jar --port 37825 target/*.war`
2016-12-18T19:07:25.592632+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-12-18T19:07:25.599057+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-12-18T19:07:25.599116+00:00 app[web.1]: Unrecognized option: --port
2016-12-18T19:07:25.599120+00:00 app[web.1]: Error: Could not create the Java Virtual Machine.
2016-12-18T19:07:25.599120+00:00 app[web.1]: Error: A fatal exception has occurred. Program will exit.
2016-12-18T19:08:20.220329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fathomless-journey-44108.herokuapp.com request_id=229e3557-e7c8-4084-9000-c14e7b0128ad fwd="109.201.209.187" dyno= connect= service= status=503 bytes=
2016-12-18T19:08:20.956253+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fathomless-journey-44108.herokuapp.com request_id=fe14db1e-c45f-4d80-9e47-d18e9d3d544d fwd="109.201.209.187" dyno= connect= service= status=503 bytes=

我的 pom.xml 中的插件

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<version>9.2.7.v20150116</version>
<destFileName>jetty-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

和 Procfile

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

最佳答案

到目前为止,我仅在免费帐户中部署了 node.js 应用程序,而没有在 Heroku 上安装插件。我要做的就是采用 heroku 分配的端口,而不是您似乎指定的静态端口

--port 37825

也许这就是问题所在?该错误似乎与端口有关。尝试在 google 上搜索“dynamic port heroku java”

关于java - 将 java web 应用程序部署到 Heroku 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41212221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com