Warm tip: This article is reproduced from stackoverflow.com, please click
jakarta-ee java jdbc wildfly

WildFly 18.0.1 JDBC Drivers : Internal error (newValue is null)

发布于 2020-04-04 10:11:40

I have a problem configuring JDBC drivers in WildFly (18.0.1).

Whenever I open (Configuration/Subsystems/DataSources & Drivers/JDBC Drivers),

I get:

Internal error (Details: newValue is null).

Error Image 1:

Error Image 2:

Any help would be very much appreciated!

Questioner
ayou392
Viewed
309
stdunbar 2019-11-29 04:45

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.