Tuesday, October 11, 2016

Install Wildfly 10.1 on Ubuntu Server 16.04

Install Wildfly 10.1 on Ubuntu 16.04

Be sure to use the same Java version as the one used as compilation target of generated WAR.

Run the following script:

sudo apt-get update
apt install software-properties-common
add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

cd /tmp
wget http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.tar.gz
tar -xzvf wildfly-10.1.0.Final.tar.gz
mv wildfly-10.1.0.Final wildfly
cp -R  wildfly /opt/

groupadd -r wildfly
useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
chown -R wildfly:wildfly /opt/wildfly

cd wildfly/docs/contrib/scripts/systemd

mkdir /etc/wildfly
cp wildfly.conf /etc/wildfly/
cp wildfly.service /etc/systemd/system/
cp launch.sh /opt/wildfly/bin/
chmod +x /opt/wildfly/bin/launch.sh

# do not launch wildfly through standalone.sh->it will screw up file permissions

systemctl start wildfly.service
systemctl enable wildfly.service
  • Watch out for CRLF EndOfLine (should be just LFs)
  • Check that Wildfly is running through systemctl status wildfly

In order to check from outside current VM/physical machine that Wildfly was started change standalone.xml content so that:

        <interface name="public">
            <any-address/>
        </interface>

There might be required some other changes to the default distribution. Besure that wildfly user is owner all added items (chown -R wildfly:wildfly /opt/wildfly/modules)

Add EclipseLink Support

  • Download eclipselink.jar to modules\system\layers\base\org\eclipse\persistence\main
  • Change module.xml so that:
    <resources>
        <resource-root path="jipijapa-eclipselink-10.1.0.Final.jar"/>
        <resource-root path="eclipselink.jar">
            <filter>
                <exclude path="javax/**" />
            </filter>
        </resource-root>
    </resources>

Add SQL Server support

  • Create modules\system\layers\base\com\microsoft\sqlserver\jdbc\main
  • Download sqljdbc4.jar
  • Create module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver.jdbc">
    <resources>
        <resource-root path="sqljdbc4.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

Add PostgreSQL Support

  • Create modules\system\layers\base\org\postgresql\main
  • Download latest JDBC PostgreSQL driver
  • Create module.xml(change driver name acordingly):
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql">
    <resources>
        <!-- Make sure this matches the name of the JAR you are installing -->
        <resource-root path="postgresql-9.4-1202.jdbc4.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>

Restart Wildfly...

Velocity Note

If some of the used components in generated WAR use Velocity you will encounter the following error in server.log (during hot deployment or Wildfly restart): Error configuring AvalonLogSystem : java.io.FileNotFoundException: /velocity.log (Permission denied). This is due to the fact that velocity.properties (as found in velocity jar, path org\apache\velocity\runtime\defaults\ states:

runtime.log = velocity.log

The quick solution is to create an empty velocity.log file in the root of your file system with full access (?) for wildfly user.

IyBJbnN0YWxsIFdpbGRmbHkgMTAuMSBvbiBVYnVudHUgMTYuMDQNCg0KKipCZSBzdXJlIHRvIHVzZSB0aGUgc2FtZSBKYXZhIHZlcnNpb24gYXMgdGhlIG9uZSB1c2VkIGFzIGNvbXBpbGF0aW9uIHRhcmdldCBvZiBnZW5lcmF0ZWQgV0FSLioqDQoNClJ1biB0aGUgZm9sbG93aW5nIHNjcmlwdDoNCmBgYA0Kc3VkbyBhcHQtZ2V0IHVwZGF0ZQ0KYXB0IGluc3RhbGwgc29mdHdhcmUtcHJvcGVydGllcy1jb21tb24NCmFkZC1hcHQtcmVwb3NpdG9yeSBwcGE6d2VidXBkOHRlYW0vamF2YQ0Kc3VkbyBhcHQtZ2V0IHVwZGF0ZQ0Kc3VkbyBhcHQtZ2V0IGluc3RhbGwgb3JhY2xlLWphdmE4LWluc3RhbGxlcg0KDQpjZCAvdG1wDQp3Z2V0IGh0dHA6Ly9kb3dubG9hZC5qYm9zcy5vcmcvd2lsZGZseS8xMC4xLjAuR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