I can reproduce your problem completely. I've not used the Wildfly console in quite some time but this looks like a bug to me. However, there is another way that has the advantage of being easily repeatable and scriptable.
If you run jboss-cli
from the Wildfly bin directory you can add a JDBC driver and JEE datasource with a script. My script looks like:
embed-server --server-config=standalone.xml --std-out=echo
batch
module add --name=org.postgres --resources=${user.home}/Downloads/postgresql-42.2.8.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
/subsystem=datasources/data-source=myDS/:add(connection-url=jdbc:postgresql://localhost:5432/dbname,driver-name=postgres,jndi-name=java:/jdbc/myDS,background-validation=true,background-validation-millis=60000,blocking-timeout-wait-millis=2000,flush-strategy=Gracefully,idle-timeout-minutes=5,initial-pool-size=4,max-pool-size=64,min-pool-size=4,password=the-password,query-timeout=10,track-statements=true,tracking=true,user-name=the-user,validate-on-match=false)
run-batch
This script should be run without the server running. If you'd like to run it while the server is running then remove the embed-server
, batch
, and run-batch
lines. Basically this starts by creating a module which in this case is a PostgreSQL driver. It then adds a JDBC driver and lastly a DataSource. It can be run with:
jboss-cli.sh --file=the-file-name.cli
assuming that you saved the above to a file named the-file-name.cli
. Again, the bin
directory for Wildfly needs to be on your path to run this on the command line.