如何将.war文件部署到在AWS EC2实例中运行的jboss服务器中?

我在AWS-EC2上创建了一个JBoss EAP实例(遵循this指南),现在我正尝试在其中部署一个简单的hello-world应用程序。

我已将.war文件复制到/ opt / rh / eap7 / root / usr / share / wildfly / standalone / deployments文件夹中,然后在/ opt / rh / eap7 /中运行了standalone.sh根/ usr / share / wildfly / bin文件夹,并得到以下日志:

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/rh/eap7/root/usr/share/wildfly

  JAVA: java

  JAVA_OPTS:  -server -verbose:gc -Xloggc:/opt/rh/eap7/root/usr/share/wildfly/standalone/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceclassUnloading -Xms1303m -Xmx1303m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

15:11:14,196 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.6.Final-redhat-00001
15:11:14,830 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.5.Final-redhat-00001
15:11:14,854 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final-redhat-1
15:11:15,170 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) starting
15:11:17,070 INFO  [org.wildfly.security] (ServerService Thread Pool -- 20) ELY00001: WildFly Elytron version 1.6.1.Final-redhat-00001
15:11:18,572 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated,and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
15:11:18,692 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 34) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated,852 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
15:11:18,905 INFO  [org.xnio] (MSC service thread 1-2) XNIO version 3.6.5.Final-redhat-00001
15:11:18,930 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.6.5.Final-redhat-00001
15:11:19,070 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 41) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
15:11:19,126 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 60) WFLYNAM0001: activating Naming Subsystem
15:11:19,114 INFO  [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 57) WFLYCONF0001: activating WildFly microProfile Config Subsystem
15:11:19,123 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 68) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
15:11:19,177 INFO  [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 59) WFLYTRACEXT0001: activating microProfile OpenTracing Subsystem
15:11:19,201 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 48) WFLYCLINF0001: activating Infinispan subsystem.
15:11:19,218 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 70) WFLYWS0002: activating WebServices Extension
15:11:19,225 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 49) WFLYIO001: Worker 'default' has auto-configured to 2 core threads with 16 task threads based on your 1 available processors
15:11:19,209 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 66) WFLYSEC0002: activating Security Subsystem
15:11:19,263 INFO  [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 58) WFLYHEALTH0001: activating eclipse microProfile Health Subsystem
15:11:19,243 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 55) WFLYJSF0007: activated the following JSF Implementations: [main]
15:11:19,316 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 50) WFLYRS0016: RESTEasy version 3.6.1.SP2-redhat-00001
15:11:19,359 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0002: Unbound mail session [java:jboss/mail/Default]
15:11:19,435 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 5.0.8.Final-redhat-1
15:11:19,569 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 2.0.15.Final-redhat-00001 starting
15:11:19,571 INFO  [org.jboss.as.connector] (MSC service thread 1-1) WFLYJCA0009: Starting JCA Subsystem (WildFly/ironJacamar 1.4.11.Final-redhat-00001)
15:11:19,571 INFO  [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=5.0.3.Final-redhat-3
15:11:19,787 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
15:11:19,878 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
15:11:19,908 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
15:11:19,958 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
15:11:19,947 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 69) WFLYUT0014: Creating file handler for path '/opt/rh/eap7/root/usr/share/wildfly/welcome-content' with options [directory-listing: 'false',follow-symlink: 'false',case-sensitive: 'true',safe-symlink-paths: '[]']
15:11:20,062 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 16 (per class),which is derived from thread worker pool sizing.
15:11:20,082 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 4 (per class),which is derived from the number of CPUs on this host.
15:11:20,601 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.
15:11:20,708 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
15:11:20,916 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
15:11:20,966 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0493: EJB subsystem suspension complete
15:11:21,208 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore /opt/rh/eap7/root/usr/share/wildfly/standalone/configuration/application.keystore not found,it will be auto generated on first use with a self signed certificate for host localhost
15:11:21,218 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/rh/eap7/root/usr/share/wildfly/standalone/deployments
15:11:21,228 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
15:11:21,236 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "hello-world.war" (runtime-name: "hello-world.war")
15:11:21,471 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
15:11:21,630 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.2.4.Final-redhat-00001 (Apache CXF 3.2.5.redhat-00001)
15:11:23,358 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Estrella Galicia' 9.3.3.Final-redhat-00001
15:11:23,971 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 72) WFLYCLINF0002: Started client-mappings cache from ejb container
15:11:24,233 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 72) WFLYUT0021: Registered web context: '/hello-world' for server 'default-server'
15:11:24,271 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 42) WFLYSRV0010: Deployed "hello-world.war" (runtime-name : "hello-world.war")
15:11:24,413 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
15:11:24,418 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
15:11:24,418 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
15:11:24,418 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 10933ms - Started 404 of 589 services (326 services are lazy,passive or on-demand)

由于我没有看到任何错误,我认为一切正常,并且我的应用已准备好运行。虽然当我卷曲时,这就是我要得到的

卷曲http://127.0.0.1:9990/hello-world 错误404-找不到

如果我只是卷曲http://127.0.0.1:9990,那么什么也没发生。

此外,当我尝试使用实例的公共DNS并喜欢 publicDNS .compute.amazonaws.com / hello-world时,该页面会给我一个ERR_CONNECTION_REFUSED。

我在这里错过了一些步骤吗?

谢谢!

lyc417402731 回答:如何将.war文件部署到在AWS EC2实例中运行的jboss服务器中?

您正试图在错误的端口上访问Web应用程序。 9990是管理端口,用于部署管理控制台。 Wildfly中Web应用程序的默认端口是8080。因此,请尝试在ec2实例上进行卷曲

http://127.0.0.1:8080/hello-world

,

另外,我遇​​到的第二个问题是,通过公共DNS无法访问该实例,我可以执行以下操作,并且可以正常工作:

由于应用服务器是JBoss 7.1独立服务器,因此我必须编辑standalone.xml并替换为:

<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>

与此:

<interface name="public">
<any-address/>
</interface>
本文链接:https://www.f2er.com/3163956.html

大家都在问