Wildfly 9 / 10 running in an encrypted Linux home folder

If you want to run Wildfly 9 or 10 in an encrypted Linux home folder, you could run into problems. If you start Wildfly 9 or 10 with the standalone-full.xml configuration, you probably see one of the errors that you can see down in the logs. In that case you can check, if you have the package libaio (in Ubuntu 16.04 it is called libaio1) installed. If so, remove it and try again. Wildfly should start without problems, because it is falling back to Java NIO. While starting Wildfly (here Wildfly 9), the following log statement showing the fallback:

[org.jboss.as.messaging] (MSC service thread 1-2) WFLYMSG0075: AIO wasn't located on this platform, it will fall back to using pure Java NIO. Your platform is Linux, install LibAIO to enable the AIO journal.

In my case libaio1 was used by the installed samba-vfs-modules, so I reinstalled it and changed the configuration of the Wildfly installations.

Problem is, that with AIO it tries to directly access the files, but there is the encryption layer in between. Falling back to Java NIO maybe cost you performance.

For JBoss 7 I found this two threads: StackOverflow and JBoss.org

Wildfly 9

Start your Wildfly 9 installation with standalone-full.xml configuration. You will see a log like the following one, showing that the HornetQ component has problems to open a file:

calibanatspace@WorkForce:~$ wildfly-9.0.2.Final/bin/standalone.sh -c standalone-full.xml
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /home/calibanatspace/wildfly-9.0.2.Final

JAVA: /usr/lib/jvm/java-8-oracle/bin/java

JAVA_OPTS: -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

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

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
22:01:25,309 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
22:01:25,413 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
22:01:25,459 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
22:01:27,087 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) 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.
22:01:27,090 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 25) 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.
22:01:27,115 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
22:01:27,132 INFO [org.xnio] (MSC service thread 1-8) XNIO version 3.3.1.Final
22:01:27,137 INFO [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.3.1.Final
22:01:27,182 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 41) WFLYCLINF0001: Activating Infinispan subsystem.
22:01:27,187 INFO [org.jboss.as.security] (ServerService Thread Pool -- 59) WFLYSEC0002: Activating Security Subsystem
22:01:27,188 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 40) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
22:01:27,193 INFO [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 4.0.9.Final
22:01:27,193 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 60) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
22:01:27,206 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
22:01:27,206 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.5.Final)
22:01:27,207 INFO [org.jboss.as.security] (MSC service thread 1-6) WFLYSEC0001: Current PicketBox version=4.9.2.Final
22:01:27,210 INFO [org.wildfly.iiop.openjdk] (ServerService Thread Pool -- 42) WFLYIIOP0001: Activating IIOP Subsystem
22:01:27,234 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: Activated the following JSF Implementations: [main]
22:01:27,236 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 52) WFLYNAM0001: Activating Naming Subsystem
22:01:27,315 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 62) WFLYWS0002: Activating WebServices Extension
22:01:27,316 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0018: Started Driver service with driver-name = h2
22:01:27,337 INFO [org.jboss.as.naming] (MSC service thread 1-4) WFLYNAM0003: Starting Naming Service
22:01:27,338 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
22:01:27,368 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0003: Undertow 1.2.9.Final starting
22:01:27,368 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0003: Undertow 1.2.9.Final starting
22:01:27,475 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0014: Creating file handler for path /home/calibanatspace/wildfly-9.0.2.Final/welcome-content
22:01:27,480 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0012: Started server default-server.
22:01:27,526 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0018: Host default-host starting
22:01:27,563 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on /127.0.0.1:8080
22:01:27,860 INFO [org.wildfly.iiop.openjdk] (MSC service thread 1-6) WFLYIIOP0009: CORBA ORB Service started
22:01:27,946 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: Started FileSystemDeploymentService for directory /home/calibanatspace/wildfly-9.0.2.Final/standalone/deployments
22:01:28,047 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
22:01:28,094 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221000: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/home/calibanatspace/wildfly-9.0.2.Final/standalone/data/messagingjournal,bindingsDirectory=/home/calibanatspace/wildfly-9.0.2.Final/standalone/data/messagingbindings,largeMessagesDirectory=/home/calibanatspace/wildfly-9.0.2.Final/standalone/data/messaginglargemessages,pagingDirectory=/home/calibanatspace/wildfly-9.0.2.Final/standalone/data/messagingpaging)
22:01:28,103 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221006: Waiting to obtain live lock
22:01:28,296 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221012: Using AIO Journal
22:01:28,400 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221043: Adding protocol support CORE
22:01:28,415 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221043: Adding protocol support AMQP
22:01:28,418 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221043: Adding protocol support STOMP
22:01:28,521 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221034: Waiting to obtain live lock
22:01:28,521 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221035: Live Server Obtained live lock
22:01:28,545 INFO [org.jboss.ws.common.management] (MSC service thread 1-4) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
22:01:28,806 WARN [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ222010: Critical IO Error, shutting down the server. file=AIOSequentialFile:/home/calibanatspace/wildfly-9.0.2.Final/standalone/data/messagingjournal/hornetq-data-1.hq, message=Can't open file: HornetQException[errorType=NATIVE_ERROR_CANT_OPEN_CLOSE_FILE message=Can't open file]
 at org.hornetq.core.libaio.Native.init(Native Method)
 at org.hornetq.core.asyncio.impl.AsynchronousFileImpl.open(AsynchronousFileImpl.java:241)
 at org.hornetq.core.journal.impl.AIOSequentialFile.open(AIOSequentialFile.java:189)
 at org.hornetq.core.journal.impl.JournalImpl.orderFiles(JournalImpl.java:377)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1728)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1323)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1306)
 at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:1541)
 at org.hornetq.core.server.impl.HornetQServerImpl.loadJournals(HornetQServerImpl.java:1851)
 at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1688)
 at org.hornetq.core.server.impl.HornetQServerImpl.access$1400(HornetQServerImpl.java:172)
 at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2207)
 at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:452)
 at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:488)
 at org.jboss.as.messaging.jms.JMSService.doStart(JMSService.java:170)
 at org.jboss.as.messaging.jms.JMSService.access$000(JMSService.java:62)
 at org.jboss.as.messaging.jms.JMSService$1.run(JMSService.java:96)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 at org.jboss.threads.JBossThread.run(JBossThread.java:320)

22:01:28,807 ERROR [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ224000: Failure in initialisation: HornetQException[errorType=NATIVE_ERROR_CANT_OPEN_CLOSE_FILE message=Can't open file]
 at org.hornetq.core.libaio.Native.init(Native Method)
 at org.hornetq.core.asyncio.impl.AsynchronousFileImpl.open(AsynchronousFileImpl.java:241)
 at org.hornetq.core.journal.impl.AIOSequentialFile.open(AIOSequentialFile.java:189)
 at org.hornetq.core.journal.impl.JournalImpl.orderFiles(JournalImpl.java:377)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1728)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1323)
 at org.hornetq.core.journal.impl.JournalImpl.load(JournalImpl.java:1306)
 at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:1541)
 at org.hornetq.core.server.impl.HornetQServerImpl.loadJournals(HornetQServerImpl.java:1851)
 at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1688)
 at org.hornetq.core.server.impl.HornetQServerImpl.access$1400(HornetQServerImpl.java:172)
 at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2207)
 at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:452)
 at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:488)
 at org.jboss.as.messaging.jms.JMSService.doStart(JMSService.java:170)
 at org.jboss.as.messaging.jms.JMSService.access$000(JMSService.java:62)
 at org.jboss.as.messaging.jms.JMSService$1.run(JMSService.java:96)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 at org.jboss.threads.JBossThread.run(JBossThread.java:320)

22:01:28,808 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 64) HQ221001: HornetQ Server version 2.4.7.Final (2.4.7.Final, 124) [92a9afda-0be1-11e6-b529-23d3b101657d] 
22:01:28,971 INFO [org.hornetq.core.server] (pool-5-thread-1) HQ221002: HornetQ Server version 2.4.7.Final (2.4.7.Final, 124) [92a9afda-0be1-11e6-b529-23d3b101657d] stopped
22:01:29,106 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
22:01:29,107 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
22:01:29,107 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 3965ms - Started 225 of 408 services (221 services are lazy, passive or on-demand)

While your Wildfly 9 instance is still running, use the cli to connect and change the configuration:

calibanatspace@WorkForce:~/wildfly-9.0.2.Final/bin$ ./jboss-cli.sh 
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9990 /] /subsystem=messaging/hornetq-server=default:write-attribute(name=journal-type,value=NIO)
{
 "outcome" => "success",
 "response-headers" => {
 "operation-requires-reload" => true,
 "process-state" => "reload-required"
 }
}
[standalone@localhost:9990 /] reload
[standalone@localhost:9990 /] exit

While reloading the instance, no errors should be thrown. You could stop and start the instance again, the logs should be fine now.

You can also change the standalone-full.xml manually. Search for the following lines and add the bold one:

 <subsystem xmlns="urn:jboss:domain:messaging:3.0">
   <hornetq-server>
     <journal-file-size>102400</journal-file-size>
     <journal-type>NIO</journal-type>

Wildfly 10

Start your Wildfly 10 installation with standalone-full.xml configuration. You will see a log like the following one, showing that the ActiveMQ component has problems to open a file:

calibanatspace@WorkForce:~$ wildfly-10.0.0.Final/bin/standalone.sh -c standalone-full.xml
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /home/calibanatspace/wildfly-10.0.0.Final

JAVA: /usr/lib/jvm/java-8-oracle/bin/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

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

21:57:56,633 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
21:57:56,754 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
21:57:56,805 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
21:57:58,377 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
21:57:58,390 INFO [org.xnio] (MSC service thread 1-2) XNIO version 3.3.4.Final
21:57:58,399 INFO [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.3.4.Final
21:57:58,434 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 41) WFLYCLINF0001: Activating Infinispan subsystem.
21:57:58,457 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 40) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
21:57:58,458 INFO [org.wildfly.iiop.openjdk] (ServerService Thread Pool -- 42) WFLYIIOP0001: Activating IIOP Subsystem
21:57:58,462 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: Activated the following JSF Implementations: [main]
21:57:58,469 INFO [org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
21:57:58,478 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 52) WFLYNAM0001: Activating Naming Subsystem
21:57:58,479 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 60) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
21:57:58,481 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
21:57:58,496 INFO [org.jboss.as.security] (ServerService Thread Pool -- 59) WFLYSEC0002: Activating Security Subsystem
21:57:58,506 INFO [org.jboss.as.security] (MSC service thread 1-6) WFLYSEC0001: Current PicketBox version=4.9.4.Final
21:57:58,509 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
21:57:58,525 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 62) WFLYWS0002: Activating WebServices Extension
21:57:58,537 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0003: Undertow 1.3.15.Final starting
21:57:58,539 INFO [org.jboss.as.naming] (MSC service thread 1-3) WFLYNAM0003: Starting Naming Service
21:57:58,540 INFO [org.jboss.as.mail.extension] (MSC service thread 1-8) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
21:57:58,540 INFO [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 4.0.18.Final
21:57:58,543 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0003: Undertow 1.3.15.Final starting
21:57:58,762 INFO [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
21:57:58,764 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
21:57:58,765 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0014: Creating file handler for path '/home/calibanatspace/wildfly-10.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
21:57:58,772 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: Started server default-server.
21:57:58,773 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting
21:57:58,869 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
21:57:59,043 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
21:57:59,043 INFO [org.wildfly.iiop.openjdk] (MSC service thread 1-1) WFLYIIOP0009: CORBA ORB Service started
21:57:59,051 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) WFLYDS0013: Started FileSystemDeploymentService for directory /home/calibanatspace/wildfly-10.0.0.Final/standalone/deployments
21:57:59,098 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=/home/calibanatspace/wildfly-10.0.0.Final/standalone/data/activemq/journal,bindingsDirectory=/home/calibanatspace/wildfly-10.0.0.Final/standalone/data/activemq/bindings,largeMessagesDirectory=/home/calibanatspace/wildfly-10.0.0.Final/standalone/data/activemq/largemessages,pagingDirectory=/home/calibanatspace/wildfly-10.0.0.Final/standalone/data/activemq/paging)
21:57:59,129 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221012: Using AIO Journal
21:57:59,216 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4) 
21:57:59,227 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
21:57:59,227 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
21:57:59,266 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
21:57:59,271 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
21:57:59,279 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
21:57:59,281 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
21:57:59,515 WARN [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ222010: Critical IO Error, shutting down the server. file=AIOSequentialFile:/home/calibanatspace/wildfly-10.0.0.Final/standalone/data/activemq/journal/activemq-data-2.amq, message=Cannot open file:Das Argument ist ungültig: java.io.IOException: Cannot open file:Das Argument ist ungültig
 at org.apache.activemq.artemis.jlibaio.LibaioContext.open(Native Method)
 at org.apache.activemq.artemis.jlibaio.LibaioContext.openFile(LibaioContext.java:290)
 at org.apache.activemq.artemis.jlibaio.LibaioContext.openFile(LibaioContext.java:273)
 at org.apache.activemq.artemis.core.io.aio.AIOSequentialFile.open(AIOSequentialFile.java:133)
 at org.apache.activemq.artemis.core.io.aio.AIOSequentialFile.open(AIOSequentialFile.java:126)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.orderFiles(JournalImpl.java:351)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1479)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1126)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1110)
 at org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:1255)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.loadJournals(ActiveMQServerImpl.java:1701)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart2(ActiveMQServerImpl.java:1595)
 at org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:60)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:393)
 at org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:381)
 at org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:194)
 at org.wildfly.extension.messaging.activemq.jms.JMSService.access$000(JMSService.java:63)
 at org.wildfly.extension.messaging.activemq.jms.JMSService$1.run(JMSService.java:97)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 at org.jboss.threads.JBossThread.run(JBossThread.java:320)

21:57:59,536 ERROR [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ224000: Failure in initialisation: ActiveMQNativeIOError[errorType=NATIVE_ERROR_CANT_INITIALIZE_AIO message=Cannot open file:Das Argument ist ungültig]
 at org.apache.activemq.artemis.core.io.aio.AIOSequentialFile.open(AIOSequentialFile.java:137)
 at org.apache.activemq.artemis.core.io.aio.AIOSequentialFile.open(AIOSequentialFile.java:126)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.orderFiles(JournalImpl.java:351)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1479)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1126)
 at org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1110)
 at org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:1255)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.loadJournals(ActiveMQServerImpl.java:1701)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart2(ActiveMQServerImpl.java:1595)
 at org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:60)
 at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:393)
 at org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:381)
 at org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:194)
 at org.wildfly.extension.messaging.activemq.jms.JMSService.access$000(JMSService.java:63)
 at org.wildfly.extension.messaging.activemq.jms.JMSService$1.run(JMSService.java:97)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
 at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.io.IOException: Cannot open file:Das Argument ist ungültig
 at org.apache.activemq.artemis.jlibaio.LibaioContext.open(Native Method)
 at org.apache.activemq.artemis.jlibaio.LibaioContext.openFile(LibaioContext.java:290)
 at org.apache.activemq.artemis.jlibaio.LibaioContext.openFile(LibaioContext.java:273)
 at org.apache.activemq.artemis.core.io.aio.AIOSequentialFile.open(AIOSequentialFile.java:133)
 ... 20 more

21:57:59,543 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.1.0.wildfly-011 [nodeID=99e5a51e-0be1-11e6-bf7b-617837b2d1aa] 
21:57:59,691 INFO [org.apache.activemq.artemis.core.server] (Thread-85) AMQ221002: Apache ActiveMQ Artemis Message Broker version 1.1.0.wildfly-011 [99e5a51e-0be1-11e6-bf7b-617837b2d1aa] stopped
21:57:59,851 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
21:57:59,852 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
21:57:59,853 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 3464ms - Started 289 of 585 services (385 services are lazy, passive or on-demand)

While your Wildfly 10 instance is still running, use the cli to connect and change the configuration:

calibanatspace@WorkForce:~/wildfly-10.0.0.Final/bin$ ./jboss-cli.sh 
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect 
[standalone@localhost:9990 /] /subsystem=messaging-activemq/server=default:write-attribute(name=journal-type, value=NIO)
{
 "outcome" => "success",
 "response-headers" => {
 "operation-requires-reload" => true,
 "process-state" => "reload-required"
 }
}
[standalone@localhost:9990 /] reload
[standalone@localhost:9990 /] exit

While reloading the instance, no errors should be thrown. You could stop and start the instance again, the logs should be fine now.

You can also change the standalone-full.xml manually. Search for the following lines and add the bold one:

 <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
   <server name="default">
     <journal type="NIO"/>

Wildfly: JDBC-Treiber und Datasource einrichten

Ich hatte hier beschrieben, wie man eine Datasource inklusive neuem JDBC-Treiber per CLI im JBoss einrichten kann. Heute wollte ich mit einer Wildfly 8.2 Installation diese Schritte durchführen, leider funktionierte es nicht, es gibt einen Bug, der das verhindert. Eine Variante, die funktioniert, ist über die Web Management Console. Eine Anleitung habe ich hier gefunden. Nachfolgend habe ich das nochmal bei nachgestellt und Screenshots davon erstellt.

JDBC-Treiber installieren

Zuerst muss ein passender JDBC-Treiber installiert werden, falls noch nicht vorhanden. Dazu öffnet man die Managementconsole, in der Regel ist sie unter Port 9990 zu finden, bei mir lokal unter http://localhost:9990/. Falls noch kein Managementuser vorhanden ist, muss man noch einen anlegen und sich dann mit diesem anmelden. Der Applikationsserver muss natürlich laufen. Dann öffnet man den Reiter Deployments.

screenshot-localhost 9990 2015-01-04 17-26-28

Ein Klick auf den Button Add öffnet den Wizard zum hinzufügen eines neuen Deployments. Hier wählt man die JAR-Datei des entsprechenden JDBC-Treibers aus und bestätigt mit Next.

screenshot-localhost 9990 2015-01-04 17-28-17

Im folgenden Fenster kann man den Namen und den Runtime-Namen noch anpassen. Zusätzlich kann man durch Auswählen von Enable den Treiber gleich aktivieren. Die Eingaben bestätigt man durch Save.

screenshot-localhost 9990 2015-01-04 17-28-55

Der installierte JDBC-Treiber sollte jetzt angezeigt werden.

screenshot-localhost 9990 2015-01-04 17-29-24

Nun wechselt man auf den Reiter Configuration. Hier wählt man bei den Subsystems -> Connector -> Datasources aus. Falls man die Konfiguration noch nicht angepasst hat, sollte die Beispieldatasource ExampleDS noch aufgeführt werden. Um jetzt eine eigene hinzuzufügen wählt man Add aus.

screenshot-localhost 9990 2015-01-05 00-04-29

Name und JNDI Adresse der neuen Datasource werden jetzt abgefragt. Der JNDI-Name hat der Adresse zu entsprechen, die man später in der persistence.xml unter dem Element jta-data-source einträgt. Die Eingaben sind mit Next zu bestätigen.

screenshot-localhost 9990 2015-01-05 01-20-30

Hier wählt man den passenden JDBC-Treiber aus und bestätigt die Eingabe wieder mit Next.

screenshot-localhost 9990 2015-01-05 00-05-17

In diesem Fenster werden die Verbindungdaten zur Datenbank eingetragen. Mit Test Connection können die Eingaben überprüft werden. Das Anlegen der Datasource ist mit Done abzuschliessen.

screenshot-localhost 9990 2015-01-05 00-06-58

screenshot-localhost 9990 2015-01-05 00-07-16

Da die Datasource noch nicht aktiviert ist, wählt man sie aus und klickt auf Enable.

screenshot-localhost 9990 2015-01-05 00-07-39

Das Fenster mit Confirm schliessen.

screenshot-localhost 9990 2015-01-05 00-08-03

Nun steht die Datasource mit dem passenden Treiber im Wildfly zur Verfügung.

Die passenden persistence.xml, die im META-INF des WARs liegen muss, sieht bei mir so aus:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
   xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
        http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
   <persistence-unit name="primary">
      <jta-data-source>java:jboss/datasources/dblocator</jta-data-source>
      <properties>
         <!-- Properties for Hibernate -->
         <property name="hibernate.hbm2ddl.auto" value="update" />
         <property name="hibernate.show_sql" value="false" />
      </properties>
   </persistence-unit>
</persistence>

Update 25.01.2015

Neuer Rechner, neues Glück. Wildfly 8.2 auf einem Ubuntu-Rechner hat jetzt noch ein anderes Verhalten an den Tag gelegt. Das Deployen eines JDBC-Treibers war dort über den oben beschriebenen Weg nicht persistent möglich. Nach jedem Neustart des Wildfly war der JDBC-Treiber weg und musste neu deployt werden.

Von JBoss gibt es hier eine gute Anleitung, wie man einen JDBC-Treiber permanent deployt. Anschliessend kann man eine Datasource einrichten, wie oben beschrieben über die webbasierte Managementconsole.

Für PostgreSQL habe ich unter wildfly/modules/org/postgres/main/modules.xml folgendes eingetragen:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.postgres">
  <resources>
    <resource-root path="postgresql-jdbc4-9.2.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

Unter wildfly/modules/org/postgres/main/ liegt in diesem Fall der JDBC-Treiber für Postgres mit dem Dateinamen postgresql-jdbc4-9.2.jar.

Zum Aktivieren des JDBC-Treibers für Postgres habe ich folgende Zeile in der JBoss CLI genutzt:

/subsystem=datasources/jdbc-driver=postgres:add(driver-name=postgres,driver-module-name=org.postgres,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

Das JBoss CLI nutzt man, in dem man den Wildfly startet, im wildfly/bin Verzeichnis jboss-cli.sh startet und sich dann mit connect mit der Wildfly-Managementconsole verbindet.