如何在OpenShift上部署Java Spring MVC项目

时间:2019-04-16 17:36:29

标签: java spring-mvc openshift

我正在OpenShift上设置Java Spring MVC项目。该项目是一个动态Web项目,不是maven。 OpenShift可以完全从Github推送代码,但是在部署过程中会出错。我们还必须转换为War文件才能部署吗?

我尝试使用OpenShift上的wildfly和jdkopen这样的不同服务器,但是它们都给出了不同的错误。对于JDKopen,它没有找到Jars。对于wildfly,所有构建和部署均已完成,但是当我使用/ home路由时,它显示404。

错误代码:

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 
 -Xms64m -Xmx256m -XX:+UseParallelOldGC -XX:+UnlockExperimentalVMOptions - 
 XX:+UseCGroupMemoryLimitForHeap -XX:MinHeapFreeRatio=10 - 
 XX:MaxHeapFreeRatio=20 -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

有关更多详细信息,请参见http://www.oracle.com/technetwork/java/javase/documentation/index.html

要成功部署的Java Web应用程序和我的路由可以正常工作

0 个答案:

没有答案