gpt4 book ai didi

java - 无法在 Openshift 中部署 Spring Boot 应用程序

转载 作者:行者123 更新时间:2023-11-29 04:20:15 24 4
gpt4 key购买 nike

我正在按照以下步骤运行我的 Spring Boot 应用程序:https://github.com/debasen/springboot-demo.gitOpen shift :

  1. 将 Red Hat OpenJDK8 添加到我的项目中。

enter image description here2.下一步 enter image description here3.添加命中库 enter image description here

完成后。我在构建时收到以下日志:

Cloning "https://github.com/debasen/springboot-demo.git " ...
Commit: c3b500b7c27540de6f1ef90734aca8b1a09d6fb6 (Initial Commit)
Author: Admin <Admin@DESKTOP-78DNBRA>
Date: Sun Mar 18 20:48:29 2018 +0530
Pulling image "registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift@sha256:afe904fd986c4147d1905813eb1a2f5bc3480ecad5b70b4ccfec384271777429" ...
==================================================================
Starting S2I Java Build .....
S2I source build with plain binaries detected
Copying binaries from /tmp/src to /deployments ...
... done

Pushing image docker-registry.default.svc:5000/boot-test1/spring-demo:latest ...
Push successful

并且部署失败并显示以下日志:

Starting the Java application using /opt/run-java/run-java.sh ...
ERROR: Neither $JAVA_MAIN_CLASS nor $JAVA_APP_JAR is set and 0 JARs found in /deployments (1 expected)
exec java -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/etc/jolokia.properties -Xms256m -Xmx256m -XX:+UseParallelGC -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:ParallelGCThreads=1 -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -XX:CICompilerCount=2 -XX:+ExitOnOutOfMemoryError -cp . -jar
Error: -jar requires jar file specification
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server,
because you are running on a server-class machine.


-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

由于在构建时没有创建 jar,部署失败。而示例存储库中的项目 https://github.com/jboss-openshift/openshift-quickstarts工作正常。我尝试使用 Heroku 来托管我的应用程序。它在 Heroku 中运行良好.但不在 Openshift 工作。请告诉我我错过了什么。

最佳答案

构建日志没有报告明确的错误,而是表明实际上没有构建任何东西:

S2I source build with plain binaries detected
Copying binaries from /tmp/src to /deployments ...
... done

作为your repo “隐藏”父文件夹中的应用程序源,请尝试指定 contextDir (即 / ,默认情况下)到 springboot-demo为您的构建,或将应用程序源移动到您的 git 存储库的根目录。

您可以使用 oc 编辑构建配置CLI oc edit bc/<build_config_name>或者在从目录部署应用程序期间提供 git 存储库 URL 时,通过单击 “高级选项” 链接或使用 操作 -> 编辑浏览现有构建配置时的菜单项。

关于java - 无法在 Openshift 中部署 Spring Boot 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49804157/

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