This is a quick revisit of a topic I covered earlier at this site with a couple up updates to address WildFly 14.
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/14.0.0.Final/wildfly-14.0.0.Final.tar.gz $ tar -xvzf wildfly-14.0.0.Final.tar.gz $ ln -s wildfly-14.0.0.Final wildfly $ ~/bin/wildfly/bin/standalone.sh -c standalone-full.xml
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.5.jar $ cd ~/bin/wildfly/bin $ ./jboss-cli.sh --connect [ firstname.lastname@example.org:9990 ] module add --name=org.postgresql --resources=/tmp/postgresql-42.2.5.jar --dependencies=javax.api,javax.transaction.api [ email@example.com:9990 ] /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgresql",driver-class-name=org.postgresql.Driver) [ firstname.lastname@example.org: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: [ email@example.com: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 while 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:
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.6.Final:jar -DoutputDirectory=. $ mvn dependency:copy -Dartifact=org.geolatte:geolatte-geom:1.3.0:jar -DoutputDirectory=. $ mvn dependency:copy -Dartifact=org.geolatte:geolatte-geojson:1.3.0: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.6.Final.jar"/> <resource-root path="geolatte-geom-1.3.0.jar"/> <resource-root path="geolatte-geojson-1.3.0.jar"/>
Add the following snippet to the <dependencies> section of the file:
<module name="org.slf4j"/> <module name="org.postgresql"/>
Finally, fire WildFly back up…
$ cd ~/bin $ ~/bin/wildfly/bin/standalone.sh -c standalone-full.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:
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!