Quick Install of WildFly 13 for Development

This is a quick revisit of a topic I covered earlier at this site with a couple up updates to address WildfFly 13.

https://dennis.gesker.com/2016/02/09/wildfly-10-on-ubuntu-15-10/

I just started playing with WildFly 13. The WildFly project is well into the process of incorporating Java/Jakarta EE features. I believe at this time that WildFly will be EE 8 compliant when the project releases WildFly 14. But, I’d like to play with these features now so it is really nice that WildFly 13 has a startup mode to let one use EE 8.

Roadmap information on any application server is best read directly from the project so check out the release page for WildFly 13 from May:

http://wildfly.org/news/2018/05/30/WildFly13-Final-Released/
Below is a quick recipe for getting WildFly onto your development machine quickly. So, here we go.

Open a terminal, get WildFly and fire it up…

$ mkdir ~/bin
$ cd ~/bin
$ wget --tries=0 --continue http://download.jboss.org/wildfly/13.0.0.Final/wildfly-13.0.0.Final.tar.gz
$ tar -xvzf wildfly-13.0.0.Final.tar.gz
$ ln -s wildfly-13.0.0.Final wildfly
$ ~/bin/wildfly/bin/standalone.sh -c standalone-ee8.xml

(The standalone-ee8.xml configuration fire turns on all the new EE 8 stuff)

Leave WildFly running and fire up a new terminal window…

$ cd ~/bin/wildfly/bin
$ ./add-user.sh -u wildfly -p wildfly -r ManagementRealm

(Please use a WAY better username and password even in development.)

At this point WildFly is running, you have established a management user and can connect to the web console at http://127.0.0.1:9990/

I use PostgreSQL most often so let’s add a driver for that. It will also be handy to have this driver installed later If I need to add a jdbc realm for authentication and of course PostgreSQL data sources for the WildFly application server to use in conjunction with your application.

$ cd /tmp
$ wget --tries=0 --continue https://jdbc.postgresql.org/download/postgresql-42.2.4.jar
$ cd ~/bin/wildfly/bin
$ ./jboss-cli.sh --connect
[ standalone@127.0.0.1:9990 ] module add --name=org.postgresql --resources=/tmp/postgresql-42.2.4.jar --dependencies=javax.api,javax.transaction.api
[ standalone@127.0.0.1:9990 ] /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgresql",driver-class-name=org.postgresql.Driver)
[ standalone@127.0.0.1:9990 ] \q
Note:
When you are ready to setup a datasource later on using the posgresql jdbc driver the command you issue will be similar to:
[ standalone@127.0.0.1:9990 ] data-source add --jndi-name=java:jboss/datasources/YourSourceDS --name=YourDataSourceDS --connection-url=jdbc:postgresql://localhost:5432/yourdatabasename --driver-name=postgres --user-name=yourPostgresqlUsername --password=yourPostgresqlPassword

Also, most of my projects have a GIS component or require some GIS functionality so let’s add that why we are setting up WildFly in our dev environment. BTW, with a little luck this next step will be easier in the future. I’ve put in a feature request with the folks on the WildFly team who work closely with the folks on the Hibernate ORM team.

These requests are at:

https://issues.jboss.org/browse/WFLY-7524
https://hibernate.atlassian.net/browse/HHH-12163
In the mean time switch back to the terminal where WildFly is running and enter Ctrl-C to stop the server. We’ll add the spatial component to Hibernate in WildFly manually.

$ cd ~/bin/wildfly/modules/system/layers/base/org/hibernate/main
$ mvn dependency:copy -Dartifact=org.hibernate:hibernate-spatial:5.3.1.Final:jar -DoutputDirectory=.
$ mvn dependency:copy -Dartifact=org.geolatte:geolatte-geom:1.3.0:jar -DoutputDirectory=.
$ mvn dependency:copy -Dartifact=org.hibernate:hibernate-spatial:5.1.14.Final:jar -DoutputDirectory=.
$ mvn dependency:copy -Dartifact=org.geolatte:geolatte-geom:1.0.6:jar -DoutputDirectory=.

Now, edit the module.xml file found in this same directory (~/bin/wildfly/modules/system/layers/base/org/hibernate/main)

Add the following snippet to the bottom of the <resources> section of the file:

<resource-root path="hibernate-spatial-5.3.1.Final.jar"> <!-- ${version.org.hibernate53} -->
<conditions>
<property-equal name="ee8.preview.mode" value="true"/>
</conditions>
</resource-root>
<resource-root path="hibernate-spatial-5.1.14.Final.jar">
<conditions>
<property-not-equal name="ee8.preview.mode" value="true"/>
</conditions>
</resource-root>

<resource-root path="geolatte-geom-1.3.0.jar"> <!-- ${version.org.hibernate53} -->
<conditions>
<property-equal name="ee8.preview.mode" value="true"/>
</conditions>
</resource-root>
<resource-root path="geolatte-geom-1.0.6.jar">
<conditions>
<property-not-equal name="ee8.preview.mode" value="true"/>
</conditions>
</resource-root> 

Add the following snippet to the <dependencies> section of the file:

<module name="org.slf4j"/>
<module name="org.postgresql"/>

Finally, fire WildfFly back up…

$ cd ~/bin
$ ~/bin/wildfly/bin/standalone.sh -c standalone-ee8.xml

At this point you should be all set to use the new EE 8 stuff on your development machine.
Below are a few links to pages on my own blog you may find helpful as you get to know WildFly or see warnings. They reference older versions of WildFly but should still be useful:
https://dennis.gesker.com/2016/02/16/wildfly-10-and-wflytx0013/
https://dennis.gesker.com/2016/02/16/add-gmail-mail-session-to-wildfly-10/
https://dennis.gesker.com/2017/08/02/wildfly-10-1-warnings-tweaking-ubuntu-17-04/
https://dennis.gesker.com/2016/02/16/wildfly-10-java-lang-outofmemoryerror-metadata-space/
Of, course hit https://WildFly.org for other specific tips and tricks.

And, I recommend joining the mailing lists for WildFly. The folks on this project seem really nice and I pick up a lot of tips and tricks just following along on various threads. Watching the commits to the project on GitHub is also a plus for anyone new to WildFly as you can watch the project evolve in real time.

Good luck with your project!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s