简体   繁体   English

AWS Elastic Beanstalk如何运行Java应用程序?

[英]How does AWS Elastic Beanstalk run a Java application?

I created an Elastic Beanstalk app on AWS using Java. 我使用Java在AWS上创建了Elastic Beanstalk应用程序。 When I run 'eb deploy' is it able to just magically find my .jar file among those uploaded? 当我运行“ eb deploy”时,是否可以在上载的文件中神奇地找到我的.jar文件? (I'm trying to demystify the magical part) I'm using Gradle to build my application so there's also a gradle-wrapper.jar in the files that I push to AWS. (我想揭开魔术部分的神秘面纱)我正在使用Gradle构建应用程序,因此在推送到AWS的文件中还存在gradle-wrapper.jar。 I'm not sure how it elects to run the correct jar file. 我不确定它如何选择运行正确的jar文件。 (which is under build/libs/myApp.jar) (位于build / libs / myApp.jar下)

When I ran a NodeJS app on AWS before, there was a spot in the configuration section in the console where you could input the "run command" for the Node project. 当我之前在AWS上运行NodeJS应用程序时,控制台的配置部分中有一个位置,您可以在其中输入Node项目的“运行命令”。 So I knew what command it was running to initiate my app (very nice). 所以我知道它正在运行什么命令来启动我的应用程序(非常好)。 There is no such thing for Java project on AWS. AWS上的Java项目没有这样的东西。

I'm struggling to find any documentation on this. 我正在努力寻找与此有关的任何文档。 Does anyone know how this works? 有谁知道这是如何工作的?

Basically your Elastic BeanStalk creates an environment for you to run your application. 基本上,Elastic BeanStalk会为您创建一个运行应用程序的环境。 This environment consits of an EC2 machine, the OS and bunch of other configurations. 此环境由EC2机器,操作系统和许多其他配置组成。 So the jar is actually run in EC2 machine inside the beanstalk. 因此,该jar实际上是在beantalk中的EC2机器中运行的。 You can think of it as a java -jar operation happening in your EC2 (for you to easily understand). 您可以将其视为EC2中发生的java -jar操作(以便您轻松理解)。

Check out this article: 查看这篇文章:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html

This describes a bit about what AWS will do by default to run your Java application. 这部分描述了AWS在默认情况下将如何运行Java应用程序。 It also talks about how to have more control over your app via Procfiles or Buildfiles. 它还讨论了如何通过Procfiles或Buildfiles更好地控制您的应用程序。 I ended up having to add a Procfile to my application to get it to work properly. 我最终不得不向我的应用程序中添加一个Procfile才能使其正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在AWS Elastic Beanstalk上安装/运行Spark Java Framework? - How to install/run Spark Java Framework on AWS Elastic Beanstalk? 使用 AWS Elastic Beanstalk 进行应用程序日志记录 - Application logging with AWS Elastic Beanstalk 将Spark-Java(Gradle,Maven)应用程序部署到AWS Elastic Beanstalk - Deploy Spark-Java (Gradle, Maven) application to AWS Elastic Beanstalk 将JVM参数传递给AWS Elastic Beanstalk上的Java应用程序 - Passing JVM Arguments to a Java application on AWS Elastic Beanstalk 结合使用AWS Elastic Beanstalk和Java / BlazeDS / Spring应用程序 - Using AWS Elastic Beanstalk with a Java/BlazeDS/Spring application AWS Elastic Beanstalk-Tomcat Java Spring Boot应用程序出现问题 - AWS Elastic Beanstalk - Problem with tomcat java spring boot application 如何在AWS Elastic Beanstalk部署的Java Web应用程序中启用WebSocket请求 - How to Enable WebSocket request in AWS Elastic Beanstalk deployed Java web application 如何将Spring Boot应用程序大战部署到AWS Elastic Beanstalk? - How to deploy Spring Boot application war to AWS Elastic Beanstalk? 如何在AWS Elastic Beanstalk中托管Java TCP服务器 - How to host a Java TCP server in AWS Elastic Beanstalk 使用 Logback 的 AWS Elastic Beanstalk 应用程序日志记录 - AWS Elastic Beanstalk Application Logging with Logback
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM