阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Java应用服务器WildFly

202次阅读
没有评论

共计 16012 个字符,预计需要花费 41 分钟才能阅读完成。

红帽公司宣布 JBoss AS 的继任者 WildFly,WildFly 将推动下一代应用服务器技术的发展,这个项目的名字是 JBoss.org 社区成员在 2012 年底投票产生。

WildFly 将继续保留 JBoss 企业应用平台并定位一些关键的中间件技术,包括更灵活和更先进的应用开发,实现开放混合云和 Java EE 7.

该项目首个迭代版本 WildFly 8 将首先通过 Java EE 7 认证,带来更简化、标准化和嵌入式特性,适合云计算和移动开发场景。

红帽已经演示了很多项目,包括 JBoss AS 7、Infinispan 以及运行在 Raspberry Pi、嵌入式设备和移动电话上。

WildFly 曾用名:JBoss Application Server

一、基础环境

1、角色、ip、版本、内核

serverA 10.1.10.185 3.2.0-4-amd64 7.8 jdk wildfly

clientB win7

wildfly-9.0.1.Final.zip

jdk-8u51-linux-x64.tar.gz

 

2、安装基础包

apt-get -y install axel unzip

 

二、安装 java 环境

1、下载

wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.Oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz”

 

2、创建目录

mkdir -p /opt/java

3、解压

tar zxvf jdk-8u51-linux-x64.tar.gz -C /opt/java/

4、配置 java 的环境变量

cat /etc/profile

export JAVA_HOME=/opt/java/jdk1.8.0_51

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

5、生效

source /etc/profile

6、查看 java 版本

1)java -version

java version “1.8.0_51”

Java(TM) SE Runtime Environment (build 1.8.0_51-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

 

7、使用 jps 命令查看相关 java 信息

1)jps -mlv

11885 sun.tools.jps.Jps -mlv -Denv.class.path=.:/opt/java/jdk1.8.0_51/lib/dt.jar:/opt/java/jdk1.8.0_51/lib/tools.jar -Dapplication.home=/opt/java/jdk1.8.0_51 -Xms8m

2) 参数说明

-m  Displays the arguments passed to the main method.The output may be null for embedded JVMs(输出 main method 的参数)

-l  Displays the full package name for the application s main class or the full path name to the application s JAR file(输出完全的包名,应用主类名,jar 的完全路径名)

-v  Displays the arguments passed to the JVM(输出 jvm 参数)

 

三、安装 wildfly

1、下载 wildfly-9.0.1.Final.zip

axel -n 10 http://download.jboss.org/wildfly/9.0.1.Final/wildfly-9.0.1.Final.zip

 

2、解压

unzip wildfly-9.0.1.Final.zip -d /opt/

 

3、改名

mv /opt/wildfly-9.0.1.Final/ /opt/wildfly

 

4、查看下目录结构

ll /opt/wildfly-9.0.1.Final/

total 424

drwxr-xr-x 3 root root  4096 Jul 23 21:01 appclient

drwxr-xr-x 5 root root  4096 Jul 23 21:01 bin

-rw-r–r– 1 root root  2451 Jul 23 21:01 copyright.txt

drwxr-xr-x 4 root root  4096 Jul 23 21:01 docs

drwxr-xr-x 5 root root  4096 Jul 23 21:01 domain

-rw-r–r– 1 root root 366323 Jul 23 21:01 jboss-modules.jar

-rw-r–r– 1 root root  26530 Jul 23 21:01 LICENSE.txt

drwxr-xr-x 3 root root  4096 Jul 23 21:01 modules

-rw-r–r– 1 root root  2531 Jul 23 21:01 README.txt

drwxr-xr-x 6 root root  4096 Jul 23 21:01 standalone

drwxr-xr-x 2 root root  4096 Jul 23 21:01 welcome-content

 

5、复制配置文件

cp /opt/wildfly/standalone/configuration/standalone.xml /opt/wildfly/standalone/configuration/standalone.xml.bak

 

6、修改配置

sed -i ‘s/127.0.0.1/10.1.10.185/’ /opt/wildfly/standalone/configuration/standalone.xml

 

7、添加 wildfly 用户用于启动脚本的

adduser –system –group –no-create-home –home /opt/wildfly/ –disabled-login wildfly

Adding system user wildfly (UID 102) …

Adding new group wildfly (GID 104) …

Adding new user wildfly (UID 102) with group wildfly …

Not creating home directory /opt/wildfly/.

 

8、更改目录权限

chown wildfly /opt/wildfly/ -R

 

9、复制启动脚本

cp /opt/wildfly/bin/init.d/wildfly-init-debian.sh /etc/init.d/wildfly

 

10、启动服务

/etc/init.d/wildfly start

[ok] Starting WildFly Application Server: wildfly.

 

11、查看端口和进程

1) 查看端口

netstat -tupnl |grep java

tcp        0      0 10.1.10.185:8080        0.0.0.0:*              LISTEN      2874/java     

tcp        0      0 10.1.10.185:9990        0.0.0.0:*              LISTEN      2874/java 

2) 查看进程

ps -ef |grep stan

wildfly    2796      1  0 11:20 pts/1    00:00:00 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml

wildfly    2874  2796  3 11:20 pts/1    00:00:06 /opt/java/jdk1.8.0_51/bin/java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/wildfly/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly/standalone/configuration/logging.properties -jar /opt/wildfly/jboss-modules.jar -mp /opt/wildfly/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly -Djboss.server.base.dir=/opt/wildfly/standalone -c standalone.xml

 

12、查看相关日志

cat /opt/wildfly/standalone/log/server.log

2015-09-29 11:20:30,338 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested.

2015-09-29 11:20:30,408 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]

2015-09-29 11:20:30,412 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0019: Host default-host stopping

2015-09-29 11:20:30,426 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0019: Stopped Driver service with driver-name = h2

2015-09-29 11:20:30,433 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0008: Undertow HTTP listener default suspending

2015-09-29 11:20:30,438 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0007: Undertow HTTP listener default stopped, was bound to /127.0.0.1:8080

2015-09-29 11:20:30,441 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0004: Undertow 1.2.9.Final stopping

2015-09-29 11:20:30,463 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0050: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) stopped in 83ms

2015-09-29 11:20:37,185 INFO  [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final

2015-09-29 11:20:37,726 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final

2015-09-29 11:20:37,819 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting

2015-09-29 11:20:37,831 DEBUG [org.jboss.as.config] (MSC service thread 1-2) Configured system properties:

    [Standalone] =

    awt.toolkit = sun.awt.X11.XToolkit

    file.encoding = UTF-8

    file.encoding.pkg = sun.io

    file.separator = /

    java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment

    java.awt.headless = true

    java.awt.printerjob = sun.print.PSPrinterJob

    java.class.path = /opt/wildfly/jboss-modules.jar

    java.class.version = 52.0

    java.endorsed.dirs = /opt/java/jdk1.8.0_51/jre/lib/endorsed

    java.ext.dirs = /opt/java/jdk1.8.0_51/jre/lib/ext:/usr/java/packages/lib/ext

    java.home = /opt/java/jdk1.8.0_51/jre

    java.io.tmpdir = /tmp

    java.library.path = /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

    java.net.preferIPv4Stack = true

    java.runtime.name = Java(TM) SE Runtime Environment

    java.runtime.version = 1.8.0_51-b16

    java.specification.name = Java Platform API Specification

    java.specification.vendor = Oracle Corporation

    java.specification.version = 1.8

    java.util.logging.manager = org.jboss.logmanager.LogManager

    java.vendor = Oracle Corporation

    java.vendor.url = http://java.oracle.com/

    java.vendor.url.bug = http://bugreport.sun.com/bugreport/

    java.version = 1.8.0_51

    java.vm.info = mixed mode

    java.vm.name = Java HotSpot(TM) 64-Bit Server VM

    java.vm.specification.name = Java Virtual Machine Specification

    java.vm.specification.vendor = Oracle Corporation

    java.vm.specification.version = 1.8

    java.vm.vendor = Oracle Corporation

    java.vm.version = 25.51-b03

    javax.management.builder.initial = org.jboss.as.jmx.PluggableMBeanServerBuilder

    javax.xml.datatype.DatatypeFactory = __redirected.__DatatypeFactory

    javax.xml.parsers.DocumentBuilderFactory = __redirected.__DocumentBuilderFactory

    javax.xml.parsers.SAXParserFactory = __redirected.__SAXParserFactory

    javax.xml.stream.XMLEventFactory = __redirected.__XMLEventFactory

    javax.xml.stream.XMLInputFactory = __redirected.__XMLInputFactory

    javax.xml.stream.XMLOutputFactory = __redirected.__XMLOutputFactory

    javax.xml.transform.TransformerFactory = __redirected.__TransformerFactory

    javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema = __redirected.__SchemaFactory

    javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom = __redirected.__XPathFactory

    jboss.home.dir = /opt/wildfly

    jboss.host.name = debian

    jboss.modules.dir = /opt/wildfly/modules

    jboss.modules.system.pkgs = org.jboss.byteman

    jboss.node.name = debian

    jboss.qualified.host.name = debian

    jboss.server.base.dir = /opt/wildfly/standalone

    jboss.server.config.dir = /opt/wildfly/standalone/configuration

    jboss.server.data.dir = /opt/wildfly/standalone/data

    jboss.server.deploy.dir = /opt/wildfly/standalone/data/content

    jboss.server.log.dir = /opt/wildfly/standalone/log

    jboss.server.name = debian

    jboss.server.persist.config = true

    jboss.server.temp.dir = /opt/wildfly/standalone/tmp

    line.separator =

    logging.configuration = file:/opt/wildfly/standalone/configuration/logging.properties

    module.path = /opt/wildfly/modules

    org.jboss.boot.log.file = /opt/wildfly/standalone/log/server.log

    org.jboss.resolver.warning = true

    org.xml.sax.driver = __redirected.__XMLReaderFactory

    os.arch = amd64

    os.name = Linux

    os.version = 3.2.0-4-amd64

    path.separator = :

    sun.arch.data.model = 64

    sun.boot.class.path = /opt/java/jdk1.8.0_51/jre/lib/resources.jar:/opt/java/jdk1.8.0_51/jre/lib/rt.jar:/opt/java/jdk1.8.0_51/jre/lib/sunrsasign.jar:/opt/java/jdk1.8.0_51/jre/lib/jsse.jar:/opt/java/jdk1.8.0_51/jre/lib/jce.jar:/opt/java/jdk1.8.0_51/jre/lib/charsets.jar:/opt/java/jdk1.8.0_51/jre/lib/jfr.jar:/opt/java/jdk1.8.0_51/jre/classes

    sun.boot.library.path = /opt/java/jdk1.8.0_51/jre/lib/amd64

    sun.cpu.endian = little

    sun.cpu.isalist =

    sun.io.unicode.encoding = UnicodeLittle

    sun.java.command = /opt/wildfly/jboss-modules.jar -mp /opt/wildfly/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly -Djboss.server.base.dir=/opt/wildfly/standalone -c standalone.xml

    sun.java.launcher = SUN_STANDARD

    sun.jnu.encoding = UTF-8

    sun.management.compiler = HotSpot 64-Bit Tiered Compilers

    sun.os.patch.level = unknown

    user.country = US

    user.dir = /opt/wildfly

    user.home = /opt/wildfly/

    user.language = en

    user.name = wildfly

    user.timezone = Asia/Shanghai

2015-09-29 11:20:37,832 DEBUG [org.jboss.as.config] (MSC service thread 1-2) VM Arguments: -D[Standalone] -XX:+UseCompressedOops -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/wildfly/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly/standalone/configuration/logging.properties

2015-09-29 11:20:39,982 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool — 17) WFLYCTL0028: Attribute ‘job-repository-type’ in the resource at address ‘/subsystem=batch’ is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.

2015-09-29 11:20:39,984 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool — 12) WFLYCTL0028: Attribute ‘enabled’ in the resource at address ‘/subsystem=datasources/data-source=ExampleDS’ is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.

2015-09-29 11:20:40,084 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)

2015-09-29 11:20:40,127 INFO  [org.xnio] (MSC service thread 1-2) XNIO version 3.3.1.Final

2015-09-29 11:20:40,163 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.3.1.Final

2015-09-29 11:20:40,256 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 4.0.9.Final

2015-09-29 11:20:40,339 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool — 38) WFLYCLINF0001: Activating Infinispan subsystem.

2015-09-29 11:20:40,341 INFO  [org.wildfly.extension.io] (ServerService Thread Pool — 37) WFLYIO001: Worker ‘default’ has auto-configured to 2 core threads with 16 task threads based on your 1 available processors

2015-09-29 11:20:40,414 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool — 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

2015-09-29 11:20:40,427 INFO  [org.jboss.as.naming] (ServerService Thread Pool — 46) WFLYNAM0001: Activating Naming Subsystem

2015-09-29 11:20:40,453 INFO  [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.4.Final)

2015-09-29 11:20:40,475 INFO  [org.jboss.as.security] (ServerService Thread Pool — 53) WFLYSEC0002: Activating Security Subsystem

2015-09-29 11:20:40,493 WARN  [org.jboss.as.txn] (ServerService Thread Pool — 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.

2015-09-29 11:20:40,435 INFO  [org.jboss.as.jsf] (ServerService Thread Pool — 44) WFLYJSF0007: Activated the following JSF Implementations: [main]

2015-09-29 11:20:40,539 INFO  [org.jboss.as.webservices] (ServerService Thread Pool — 56) WFLYWS0002: Activating WebServices Extension

2015-09-29 11:20:40,566 INFO  [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=4.9.2.Final

2015-09-29 11:20:40,617 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2

2015-09-29 11:20:40,725 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool — 55) WFLYUT0003: Undertow 1.2.9.Final starting

2015-09-29 11:20:40,765 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service

2015-09-29 11:20:40,733 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 1.2.9.Final starting

2015-09-29 11:20:40,782 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]

2015-09-29 11:20:41,211 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool — 55) WFLYUT0014: Creating file handler for path /opt/wildfly/welcome-content

2015-09-29 11:20:41,397 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.

2015-09-29 11:20:41,707 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting

2015-09-29 11:20:41,737 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on /10.1.10.185:8080

2015-09-29 11:20:42,175 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]

2015-09-29 11:20:42,209 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly/standalone/deployments

2015-09-29 11:20:42,510 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBoss Web Services – Stack CXF Server 5.0.0.Final

2015-09-29 11:20:42,890 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://10.1.10.185:9990/management

2015-09-29 11:20:42,893 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://10.1.10.185:9990

2015-09-29 11:20:42,894 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started in 6225ms – Started 203 of 379 services (210 services are lazy, passive or on-demand)

四、测试 (clientB)

1、输入 10.1.10.185:8080 后看到页面出来了

Java 应用服务器 WildFly

10.1.10.185:9990 后看到管理页面

Java 应用服务器 WildFly

3、添加管理者

cd /opt/wildfly/bin

./add-user.sh

What type of user do you wish to add?

 a) Management User (mgmt-users.properties)

 b) Application User (application-users.properties)

(a): a

Enter the details of the new user to add.

Using realm ‘ManagementRealm’ as discovered from the existing property files.

Username : admin

The username ‘admin’ is easy to guess

Are you sure you want to add user ‘admin’ yes/no? yes

Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.

 – The password should be different from the username

 – The password should not be one of the following restricted values {root, admin, administrator}

 – The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)

Password :

WFLYDM0099: Password should have at least 8 characters!

Are you sure you want to use the password entered yes/no? yes

Re-enter Password :

What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[]:

About to add user ‘admin’ for realm ‘ManagementRealm’

Is this correct yes/no? yes

Added user ‘admin’ to file ‘/opt/wildfly/standalone/configuration/mgmt-users.properties’

Added user ‘admin’ to file ‘/opt/wildfly/domain/configuration/mgmt-users.properties’

Added user ‘admin’ with groups  to file ‘/opt/wildfly/standalone/configuration/mgmt-groups.properties’

Added user ‘admin’ with groups  to file ‘/opt/wildfly/domain/configuration/mgmt-groups.properties’

Is this new user going to be used for one AS process to connect to another AS process?

e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.

yes/no? yes

To represent the user add the following to the server-identities definition <secret value=”cmVkaGF0″ />

PS: 根据提示创建管理用户

Java 应用服务器 WildFly

WildFly 的详细介绍 :请点这里
WildFly 的下载地址 :请点这里

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2015-10/123768.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计16012字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中