在本文中,我将向你展示如何在Ubuntu 18.04操作系统上安装WildFly 18,并将它连接到Eclipse IDE的方法,其他Linux发行版可参考,如Ubuntu 16.04/19.10、Debian 10/9等。
前言 在开发Java EE/Jakarta EE项目时,将需要Java服务器,一些最常用的Java Enterprise服务器包括Apache Tomcat、Glassfish、Jetty和WildFly/JBoss服务器,并非所有这些服务器都提供所有必需的功能,但是它们全部都提供了所需的大多数企业功能,Glassfish和WildFly/JBoss提供了完整的功能集,并且大多数由企业使用。 Wildfly和JBoss AS有什么区别?Wildfly是Java EE服务器的社区版本,而JBoss As是企业的企业版本,两者都是由Redhat Inc.赞助的,因此JBoss AS简而言之就是WildFly的安全版本。 同时,要做的第一件事是安装Java,参考在Ubuntu 18.04/16.04系统上安装Java 8的两种方法,你可以自由安装其他的版本,如: $ java -version openjdk version "11.0.4" 2019-07-16 OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3) OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
在Ubuntu 18.04上安装WildFly 18的方法 我们将下载WildFly 18并选择安装位置,我正在~/eclipse/servers/下安装: mkdir -p ~/eclipse/servers cd ~/eclipse/servers wget https://download.jboss.org/wildfly/18.0.1.Final/wildfly-18.0.1.Final.zip unzip wildfly-18.0.0.Final.zip 参考:在Ubuntu 18.04、Debian 10/9上安装WildFly的步骤。 之后,我们添加管理员来管理某些数据源,例如数据源: cd wildfly-18.0.0.Final/bin/ ./add-user.sh 按照如下所示的说明填写问题:
配置管理员时的说明。 配置完成后,如下所示独立启动WildFly服务器实例: $ ./standalone.sh JBoss Bootstrap Environment JBOSS_HOME: /home/eugene/eclipse/servers/wildfly-18.0.1.Final JAVA: java JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED 09:56:39,410 INFO [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final 09:56:40,063 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final 09:56:40,074 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final 09:56:40,248 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) starting 09:56:41,485 INFO [org.wildfly.security] (ServerService Thread Pool -- 26) ELY00001: WildFly Elytron version 1.10.4.Final 09:56:42,239 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. 09:56:42,334 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 36) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' 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. 09:56:42,401 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http) 09:56:42,440 INFO [org.xnio] (MSC service thread 1-4) XNIO version 3.7.3.Final 09:56:42,455 INFO [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.7.3.Final 09:56:42,554 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 43) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4) 09:56:42,566 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) WFLYCLINF0001: Activating Infinispan subsystem. 09:56:42,613 INFO [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 60) WFLYCONF0001: Activating WildFly MicroProfile Config Subsystem 09:56:42,614 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 5.0.15.Final 09:56:42,590 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 53) WFLYRS0016: RESTEasy version 3.9.1.Final 09:56:42,612 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.17.Final) 09:56:42,620 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2 09:56:42,621 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 58) WFLYJSF0007: Activated the following JSF Implementations: [main] 09:56:42,659 INFO [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 61) WFLYHEALTH0001: Activating Eclipse MicroProfile Health Subsystem 09:56:42,662 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 64) WFLYNAM0001: Activating Naming Subsystem 09:56:42,677 INFO [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 62) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem 09:56:42,714 INFO [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 63) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem 09:56:42,686 INFO [org.jboss.as.naming] (MSC service thread 1-7) WFLYNAM0003: Starting Naming Service 09:56:42,739 INFO [org.jboss.as.security] (ServerService Thread Pool -- 70) WFLYSEC0002: Activating Security Subsystem 09:56:42,785 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 74) WFLYWS0002: Activating WebServices Extension 09:56:42,777 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 52) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors 09:56:42,771 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default] 09:56:42,771 INFO [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=5.0.3.Final 09:56:42,760 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 72) 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. 09:56:42,939 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0003: Undertow 2.0.27.Final starting 09:56:43,085 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 73) WFLYUT0014: Creating file handler for path '/home/eugene/eclipse/servers/wildfly-18.0.1.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]'] 09:56:43,100 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: Started server default-server. 09:56:43,102 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting 09:56:43,113 INFO [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host. 09:56:43,113 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing. 09:56:43,286 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080 09:56:43,488 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0493: EJB subsystem suspension complete 09:56:43,574 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] 09:56:43,763 INFO [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none 09:56:43,795 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore /home/eugene/eclipse/servers/wildfly-18.0.1.Final/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost 09:56:43,828 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /home/eugene/eclipse/servers/wildfly-18.0.1.Final/standalone/deployments 09:56:43,920 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443 09:56:44,010 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBossWS 5.3.0.Final (Apache CXF 3.3.3) 09:56:44,207 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server 09:56:44,210 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management 09:56:44,211 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990 09:56:44,211 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) started in 5378ms - Started 315 of 577 services (369 services are lazy, passive or on-demand) 当服务器运行时,可以从http://localhost:9990/console访问Web管理界面,你可以使用Web管理界面来创建数据源、管理部署和配置服务器:
将WildFly 18添加到Eclipse IDE的方法 调出Eclipse IDE,然后转到“帮助”>“安装新软件...”>(Help > Install New Software… > Work with)。 单击Add以添加JBoss工具插件: Name:JBoss Tools 位置:http://download.jboss.org/jbosstools/photon/development/updates/
选择你需要的功能,然后单击完成并重新启动。 重新启动后,单击服务器选项卡,通常,它是空白的,带有创建服务器的链接,单击链接以打开用于配置服务器的窗口。
从Jboss社区列表中选择WildFly18,单击下一步,然后设置已安装的WildFly的主目录,其余的将为你配置,单击完成。
测试WildFly 18与Eclipse IDE的集成 创建一个简单的项目来测试你的服务器,通常情况下,如无错误的操作就能行。
至此,目的达到,测试WildFly 18服务器可用性很成功。
相关主题 |