JBoss Faqs - WildFly Faqs

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Here I have collected some WildFly faqs I've often come across and still are being asked on forums. Feel free to This email address is being protected from spambots. You need JavaScript enabled to view it. and add yours!

What is the difference between JBoss EAP 6 and JBoss AS 7 / WildFly ?
JBoss EAP 6 is the Red Hat supported version of the Community application server JBoss AS 7. In terms of configuration and libraries they are a close match although JBoss EAP 6 is still actively being supported with new server minor releases by Red Hat while JBoss AS 7 has been discontinued by the Development teams in favour of WildFly, which is the current upstream project you can use to run your projects. That means, if you want to stay on the Community project, you are encouraged to migrate to WildFly: http://www.wildfly.org/

What is the match between WildFly 8/9 and JBoss EAP ?
There is no match between WildFly 8/9 and version of JBoss EAP. The current release of WildFly (10) is the baseline for Jboss EAP 7. See the next question to learn how to migrate applications from AS 7 / WildFly 8 / WildFly 9 to WildFly 10 (nearly all concepts apply in migrating WildFly 8 to JBoss EAP 7)

Where can I find nightly builds of WildFly ?
WildFly latest builds can be obtained from this CI: https://ci.jboss.org/hudson/job/WildFly-latest-master/lastBuild/

How do I migrate to WildFly 10 ?
This migration requires a careful planning as several differences between the server releases do exist. The following table depicts the challenges you have to face when migrating from JBoss AS 7 or WildFly 8 to WildFly 10

Upgrade actions required
JBoss AS 7
WildFly 8
WildFly 9
Major Upgrade in Java EE API Version
Yes
No
No
Upgrade to Java 8
Yes
Yes
Yes
Changes in Management Port
Yes
No
No
Changes in Remoting Protocol
Yes
No
No
New Messaging subsystem (artemis-mq)
Yes
Yes
Yes
New Webserver subsystem (undertow)
Yes
No
No

Let's see more in detail some changes needed: In terms of Java EE applications, WildFly is based upon Java EE 7 whilst JBoss AS 7 ships with Java EE 6 implementation libraries. In most cases backward compatibility assures that your applications will work out of the box, however there are some critical areas such as Hibernate/JPA: WildFly 10 ships with a default Hibernate 5 implementation (although some 4.1 and 4.3 slots are available in the modules). Before committing to a WildFly 10 upgrade verify the Hibernate 5.0 migration guide: https://github.com/hibernate/hibernate-orm/blob/5.0/migration-guide.adoc

Another migration point is EJB Remoting. Since WildFly 8, the protocol used for EJB communication relies upon the Undertow HTTP Upgrade mechanism, hence you have to upgrade your EJB Client libraries and also the ejb-client.properties file (or the source code used to connect to remote EJBs)

Next on the list is the new Web Server: WildFly 8 has switched to a different Web Server implementation named Undertow, which is the embedded Web server providing both blocking and non­blocking API based on NIO. Besides the API enhancements, the Undertow Web server can provide better flexibility thanks to its composition based architecture that allows you to build a Web server by combining small single purpose handlers.
Another migration point for AS 7 users is the native management port. WildFly 8 reduced the number of ports by multiplexing invocations over the HTTP channel; Hence you will not use anymore the port 9999 for connecting to the CLI so you have to modify your scripts (if any) accordingly.
Then, all pre-WildFly 10 server releases will need migrating to Apache Artemis MQ which is derived from the HornetQ project, recently donated to the Apache foundation. The new messaging provides retains compatibility with the former HornetQ while providing several new features. Although the features are maintained, the configuration needs to be ported to the equivalent Apache Artemis MQ.

Finally, WildFly 10 mandates that you are using a JDK 1.8 or higher. So you have to upgrade your earlier JDK 1.6/1.7 if you have any.

How do I change the location where the application server modules are picked up ?

By setting the JBOSS_MODULEPATH, you can specify additional paths for your modules. Here’s an example: (Linux users):

JBOSS_MODULESPATH=/usr/libs/custom-modules:$JBOSS_HOME/modules

How to create additional module layers (so that you don't impact the base distribution) ?

Sometimes you have to provides non official patches or new features to the application server. The best way to do that is by means of the layers.conf file which can be added in the modules folder. For example, supposing you are adding infinispan server modules to your WildFly server: then create a parallel layer named "infinispan" with the unpacked libraries in it. Then create a file named layers.conf with the following content:

layers=infinispan

You can optionally include also the "base" layer which will be anyway appended to the end of the list. This way, when loading modules, the infinispan layer will take precedence over the "base" layer and you don't pollute the default distribution.

What is the module name of a deployed application ?

Here’s the rule to determine the module name: applications that are packaged as top-level archives (such as WAR, JAR, and SAR) are assigned the following module name:

deployment.[archive name]

For example, a Web application named WebExample1.war will be deployed as module name:

deployment.WebExample1.war

Is it possible to configure the order extensions are being loaded by the server at boot time ?

Since the server extensions load their modules using separate threads, it is not predictable the order in which each extension is loaded first. However each module can declare a dependency to other modules, in order to avoid a failure at start up.

How do I use System Properties in the server configuration ?

System Properties can be included in the configuration via the standard BeanShell expression (e.g. ${property:defaultValue} ). Here is an example how to use a System Property in a Datasource:

<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
   <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySQLPool">
   <connection-url>${connection.url}</connection-url>
   <driver>mysql-connector-java-5.1.24-bin.jar</driver>
. . . .
   </datasource>
</datasources>

In order to get working the property replacement, you have to check that the jboss-descriptor-property-replacement (part of the ‚ee‛ domain) is set to true:

<subsystem xmlns="urn:jboss:domain:ee:1.1">
   <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
</subsystem>

Can I safely remove the ExampleDS Datasource from the configuration ?

Removing the ExampleDS Datasource will not prevent your server to start, however consider that since Java EE 7 has mandated the concept of the Default Datasource to be available on the a Java EE Container, you will might find some exceptions in your server log. In order to configure the Default Datasource, you have to set the datasource attribute available in the ee subsystem's default bindings:

[standalone@localhost:9990 /] /subsystem=ee/service=default-bindings:read-attribute(name=datasource)
{
    "outcome" => "success",
    "result" => "java:jboss/datasources/ExampleDS"
}

How do I move a standalone configuration to a Domain configuration?
There is no automatic tooling to do that. That being said, however, you can convert your standalone configuration to a Domain configuration as follows:
Copy the standalone profile:

 <profile>
        <subsystem xmlns="urn:jboss:domain:logging:3.0">
        ....
 </profile>

 ..in your domain.xml and assign it a profile name:

<domain xmlns="urn:jboss:domain:4.0">
. . . .
   <profile name="my-profile">
            <subsystem xmlns="urn:jboss:domain:logging:3.0">
             . . .
   </profile>
</domain>

Then reference your profile into the Server Groups that are using this profile:

<server-group name="main-server-group" profile="my-profile">
. . .
</server-group>

When done with profiles, you need to port the Management and Security realm section of your Standalone configuration to your Domain:

<management>
        <security-realms>
            <security-realm name="ManagementRealm">
        . . . .
</management>

In this case, being a configuration related to the Host machines of your Domain, you have to re-create this configuration in the host.xml files of your Domain.

Can I use log4j to print the application server logs?

No, in JBoss AS 7 and onwards the core logging features are provided by JBoss Logging framework which is based on the Java JUL framework. That being said, you can still use log4j in your application by placing the configuration file in the appropriate folder: EAR files should contain the configuration in the META­-INF directory. On the other hand, in a WAR or JAR deployment the configuration files can be in either the META­INF or WEB­INF/classes directories. Additionally you should either package the log4j JAR in your application or activate the available module, for example by including in your Manifest file:

Dependencies: org.apache.log4j

How can I have my application log printed in a different file from server.log ?

The simplest way to do it is creating a new Handler which writes in another path. Then create a Logger with the namespace of your application (e.g. com.acme) which references your Handler and has use-parent-handlers set to false

Can I rotate my log files based on a time factor ?

Yes, you can define a Size Rotating handler; this handler writes to a file, rotating the log after a the size of the file grows beyond a certain point and keeping a fixed number of backups. Example:

/subsystem="logging"/size-rotating-file-handler="SIZEHANDLER":add(append="true",autoflush="true",file={"relative-to" =>"jboss.server.log.dir","path" => "largelog.log"},max-backup-index=1,rotate-on-boot=true,rotate-size=2m)

I have created a Periodic File Handler but log file is not being written. Why ?

Check out at first that your Log level is consistent with your Logging statements. Next, check if the log is being written as 0 size or not at all. If the log file is absent, chances are that it's being written in a different location. Otherwise an empty log file is often because you have left the default auto-flush attribute to false, which means that messages will be buffered and later printed.

Is it better to install a JDBC Driver as a module or deploy it as a JAR ?

Both cases work well and have pros and contros. Installing it as a JAR is obviously simpler, especially in Domain mode since you will be able to distribute the Driver across all server groups in one shot; if you have to do it as a module you should install the module on every single Host. On the other hand, installing it as a module shields you from changes in the JAR version (and name) as you will refer to a module name and not to a JAR file name. Also you will keep a better separation between your application code and the infrastructure code.

I need a clustered environment. Do I need to use Domain mode ?

No, no, no and no!! This is a common misconception about Domain mode. Domain mode will let you manage and configure your servers from a Centralized point, called the Domain Controller but it does not add/remove anything in terms of Enterprise features. What's the truth behind it is that it's inherently to set up a cluster in Domain mode as, once you have setup an ha/full-ha profile and port offset, your cluster is ready to start. On the opposite, when running a Standalone cluster you have to start and configure each single Standalone instance to be cluster-aware and solve port conflicts in separate files.

Which are the advantages of using an UDP cluster vs a TCP cluster ?

UDP advantages

  • Usually faster than TCP because it does need to issue the acknowledge packet (ACK) that permits a continuous packet stream.
  • Generally more efficient as it's possible to do reliable delivery to a group of people instead of TCP's point-to-point acknowledgement.
  • Can reduce app-level latency by accepting an out-of-order delivery.

TCP advantages

  • TCP has control over network congestion.
  • On a larger scale, this TCP behavior is what keeps the Internet from locking up into "congestion collapse".
  • Firewalls won’t usually block you.
  • If you are behind reliability, adding lots of layers in the UDP communication might end in being slower than TCP.

How do I persist my JMS messages on a Database ?

This is not possible to do it natively because the default messaging system only persists on a file the messages. As an alternative you can use a resource adapter which connects to ActiveMQ, which is capable of persisting messages on a database.

How do I enable persistence of JMS messages on the Journal ?

In order to enable JMS persistence you have to make sure that the persistence-enable element is set to true in the messaging subsystem:

<persistence-enabled>true</persistence-enabled>

How do I enable paging of JMS messages ?

HornetQ will start paging messages to disk, when the size of all messages in memory for an address exceeds a configured maximum size.By default, HornetQ does not page messages - this must be explicitly configured to activate it. Here is the relevant parameter in the configuration:

<address-settings>
   <address-setting match="#">
      <dead-letter-address>jms.queue.DLQ</dead-letter-address>
      <expiry-address>jms.queue.ExpiryQueue</expiry-address>
      <redelivery-delay>0</redelivery-delay>
      <max-size-bytes>10485760</max-size-bytes>
      <page-size-bytes>2097152</page-size-bytes>
      <address-full-policy>PAGE</address-full-policy>
      <message-counter-history-day-limit>10</message-counter-history-day-limit>
   </address-setting>
</address-settings>

How do I reverse engineer my configuration to CLI scripts ?

There is no built-in solution for that, however most admins and developers love this project which works pretty well: Reverse engineer your JBoss AS-WildFly configuration to CLI

How do I switch to TCP for my cluster ?

Out of the box the application server ships with a tcp and udp JGroups configuration, the latter being the default one. The simplest way to achieve that is by means of changing the “ee” channel to use a different stack. For example, if you want to use tcp, execute from the CLI:

/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)

 In many cases however a static clustered configuration is required. You can read more about that on the following articles: How to configure JBoss EAP and WildFly to use TCPPING  Configuring JBoss EAP 6 - WildFly to use TCP for messaging
What if I find a bug in WildFly ?

It is at first highly recommended to discuss about in on the forums at http://www.jboss.org/forums to make a first sanity check. Next, move to the Issue Tracking system at: https://issues.jboss.org/secure/Dashboard.jspa where you can browse issue by projects. You need to register before commiting an issue.
Then, provide the following information:

  • The operating system you are using
  • The JDK or JRE you are using
  • As much of the stack trace (if there is one) as necessary to show the cause of the problem.
  • A list of steps needed to reproduce the bug.

Where is the source code and how do I contribute to the Project ?

The source code is available as a zip on http://wildfly.org/downloads/ . If you want to contribute to the project, fork the master project on https://github.com/wildfly/wildfly and start working on it! The page http://wildfly.org/joinus/ contains all the information you require to get started with it.

Follow us on Twitter