很多都内容都是见解了别人写的博客,与有雷同,那是正常的。
wildfly服务器是基于Jboos的, 是一个基于J2EE的 开放源代码 应用服务器 。 JBoss代码遵循LGPL许可,可以在任何商业应用中免费使用,而不用支付费用。JBoss是一个管理EJB的容器和服务器,支持EJB 1.1、EJB 2.0和EJB3的规范。但JBoss核心服务不包括支持servlet/JSP的WEB容器,一般与Tomcat或Jetty绑定使用。
上面是一个简单的应用,具体的详细,请自己找。在这篇文章中,我们具体讲一下 wildfly 的 domain方式的单机搭建。

1、 Wildfly 下载   地址 : http://wildfly.org/downloads/    最好是能将内存设置的大一些
版本众多,我们选择 8.2版本


2、 下载完成后放到Liunx上,我存放在 /usr/local 路径下。 我的主机IP是 192.168.80.10
安装过程: tar -zxvf  wildfly-8.2.0.Final.tar.gz   并将  wildfly-8.2.0.Final 改名为 wildfly8  


配置wildfly的用户名及密码 具体的步骤下如:
/usr/local/wildfly8/bin    执行  ./add-user.sh

./add-user.sh    Enter
What type of user do you wish to add? 
 a) Management User (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): a     Enter
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username :admin      Enter  这个可自定义  但建议写admin

Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - 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)
 - The password should be different from the username
Password :     这里输入密码   Enter

JBAS015267: Password must have at least 1 non-alphanumeric symbol.
Are you sure you want to use the password entered yes/no?   yes   Enter

Re-enter Password :   这里是重复密码  Enter

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

About to add user 'admin' for realm 'ManagementRealm'
Is this correct yes/no?  yes   Enter

Added user 'admin' to file '/usr/local/wildfly8/standalone/configuration/mgmt-users.properties'
Added user 'admin' to file '/usr/local/wildfly8/domain/configuration/mgmt-users.properties'
Added user 'admin' with groups admin to file '/usr/local/wildfly8/standalone/configuration/mgmt-groups.properties'
Added user 'admin' with groups admin to file '/usr/local/wildfly8/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  Enter
To represent the user add the following to the server-identities definition <secret value=" YWRtaW4xMjM =" />   这个值是用来做集群的
新建用户完成之后 开始配置相关文件:我这里要单机配置,所以我们这里只关心一个配置文件
cd   /usr/local/wildfly8/domain/configuration   进入到这个目录下
编辑host.xml
<?xml version='1.0' encoding='UTF-8'?>
<host name="master" xmlns="urn:jboss:domain:2.2">
    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <authentication>
                    <local default-user="$local" skip-group-loading="true" />
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
                <authorization map-groups-to-roles="false">
                    <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>                
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" skip-group-loading="true" />
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir" />
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <audit-log>
            <formatters>
               <json-formatter name="json-formatter"/>
            </formatters>
            <handlers>
                <file-handler name="host-file" formatter="json-formatter" relative-to="jboss.domain.data.dir" path="audit-log.log"/>
                <file-handler name="server-file" formatter="json-formatter" relative-to="jboss.server.data.dir" path="audit-log.log"/>
            </handlers>
            <logger log-boot="true" log-read-only="false" enabled="false">
               <handlers>
                  <handler name="host-file"/>
               </handlers>
            </logger>
            <server-logger log-boot="true" log-read-only="false" enabled="false">
                <handlers>
                    <handler name="server-file"/>
                </handlers>
            </server-logger>
        </audit-log>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
       <local/>
       <!-- Alternative remote domain controller configuration with a host and port -->
       <!-- <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/> -->
    </domain-controller>

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.80.10}"/>
        </interface>
        <interface name="public">
           <inet-address value="${jboss.bind.address:192.168.80.10}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:192.168.80.10}"/>
        </interface>
    </interfaces>

     <jvms>
        <jvm name="default">
          <heap size="64m" max-size="256m"/>
          <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
            </jvm-options>
       </jvm>
     </jvms>

    <servers>
        <server name="server-one" group="main-server-group">
        </server>
    </servers>
</host>
注意,要与你自己的host.xml与我写的进行对比,看一下哪里有不同;配置完成后 保存
3、配置服务:
vim /etc/default/wildfly.conf
## jdk的安装路径
JAVA_HOME="/usr/local/jdk"

## JBOSS_HOME是Wildfly的安装根目录 之前为什么要进行改名 就是要用在这里
JBOSS_HOME="/usr/local/wildfly8"

## 这里需要改为执行当前登录Liunx系统的用户名
JBOSS_USER=root
## 指定运行模式为domain
JBOSS_MODE=domain

## 指定domain的配置文件为domain.xml,slave的配置文件为host.xml
JBOSS_DOMAIN_CONFIG=domain.xml
JBOSS_HOST_CONFIG=host.xml

4、为系统配置服务
##将.sh启动命令放到系统目录下  
cp wildfly8/bin/init.d/wildfly-init-redhat.sh /etc/init.d/wildfly

##增加执行权限  
chmod +x /etc/init.d/wildfly  

##增加系统服务  
chkconfig --add wildfly  

##设置开机启动  
chkconfig wildfly on  

##启动wildfly,记得先启动master  
service wildfly start  

5、下面我们就可以进行验证了



上述我们将了如何搭建wildfly domian 的方式  下面我再讲述一下 如何在 wildfly中 使用 kie-server+wornbench

第一步:就是下载 wildfly 所用的两个war包,及 kie-server,workbench
http://www.drools.org/download/download.html 下载地址。 之前有讲过kie-server的安装在tomcat下。这里发生的变化只是不在用tomcat workbench war包 

和之前一样 将下载好的war包 改名成  kie-wb.war  
kie-server.war  只是我们这里不能解压,是通过在下载后的路径下进行修改名称

kie-server-6.5.0.Final-ee7.war改名为kie-server.war
第二步:将这两个已经改好名的上传到wildfly中,具体操作步骤:




然后我们选择下面这个菜单完成配置文件的设置,这里的配置与setenv.sh很像

我们找到 System Properties 选项卡

java.net.preferIPv4Stack
true     这个是默认的
true
org.kie.demo
false
true
org.kie.example
false
true
org.kie.server.controller
http://192.168.80.10:8080/kie-wb/rest/controller
true
org.kie.server.controller.pwd
kieserver
true
org.kie.server.controller.user
kieserver
true
org.kie.server.id
wildfly-kieserver
true
org.kie.server.location
http://192.168.80.10:8080/kie-server/services/rest/server
true
org.kie.server.persistence.dialect
org.hibernate.dialect.H2Dialect
true
org.kie.server.persistence.ds
java:jboss/datasources/ExampleDS
true
org.kie.server.persistence.tm
org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform
true
这些配置完成后 要不急,还要去服务器上创建新的用户。即workbench 和kie-server的用户。
配置过程与上面说的一样。 只是之前是系统用户,这次我们要创建应用用户,将之前写的 a  改成 b 用户类型 后面的步骤是一样的。但在创建kie-server用户时要注意,它的分组必须是kie-server。在tomcat里 用户名和密码都必须是默认的,但在wildfly里 是可以改变的,如果没有设置的话,就必须是默认用户及密码。
完成所以步骤后,重启服务,和之前介绍workbench一样 直接打开就可以了,地址 http://192.168.80.10:8080/kie-wb
页面正常打开就成功了,如果页面不能正常访问,则肯定是有步骤出错了,请重新配置就好。

下面是小编的微信转帐二维码,小编再次谢谢读者的支持,小编会更努力的

----请看下方↓↓↓↓↓↓↓

百度搜索 Drools从入门到精通:可下载开源全套Drools教程

深度Drools教程不段更新中:


更多Drools实战陆续发布中………

扫描下方二维码关注公众号 ↓↓↓↓↓↓↓↓↓↓



Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐