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

6

18

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!

Newcomer answered 27/11, 2019 at 18:10 Comment(3)
Is there anything in the server logs (normally in standalone/log/server.log under your Wildfly install)?Province
There is nothing in the log files that's indicating a problem. Also nothing changes after I get the error in the log file.Newcomer
I have the same problem and no idea why. I installed version 18.0.1_Final and 16.0.0_Final, but same issue. Have you already found a solution?Irk
P
3

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.

Province answered 28/11, 2019 at 20:45 Comment(0)
P
16

This is not a wildfly/jboss problem. The bug is in Hal Management console (version 3.2.1). I fix this error, changing HAL console version to 3.2.4.

  1. Download release:
wget https://repository.jboss.org/nexus/content/repositories/ea/org/jboss/hal/hal-console/3.2.4.Final/hal-console-3.2.4.Final-resources.jar
  1. Copy the jar file to wildfly directory
sudo cp hal-console-3.2.4.Final-resources.jar /opt/wildfly/modules/system/layers/base/org/jboss/as/console/main/
  1. Edit the file module.xml
sudo vim /opt/wildfly/modules/system/layers/base/org/jboss/as/console/main/module.xml
  1. Change version in file module.xml
   <resources>
        <resource-root path="hal-console-3.2.4.Final-resources.jar"/>
    </resources>
  1. Restart jboss/wildfly
sudo systemctl restart wildfly or sudo service wildfly restart
Proposal answered 31/1, 2020 at 13:49 Comment(7)
The github archive doesn't seem to contain the target folder, only the source code. So we either build that maven project, or extract a console jar from somewhere else, e.g. a WildFly 19 beta.Backup
Step 1a. - install maven, cd app, mvn package (then wait, then copy the jar)Conclude
I forgot to include the step to compile the src. I will add this in my answerProposal
Correct URL is repository.jboss.org/nexus/content/repositories/ea/org/jboss/…Havildar
Thanks @Giampaolo, I edit the answer providing your linkProposal
Another little thing: restarting the server is not enough, you need to force browser cache refresh ^ _ ^ 'Havildar
Upgrading to 3.2.4 + clearing browser cache works for me. If you want to upgrade to version newer than 3.2.4, find it under this directory: repository.jboss.org/nexus/content/repositories/ea/org/jboss/….Leigha
P
3

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.

Province answered 28/11, 2019 at 20:45 Comment(0)
P
2

This is apparently a known problem (see https://developer.jboss.org/thread/280649 and https://issues.redhat.com/browse/WFLY-12642) and will be fixed in the next release.

Pelson answered 12/1, 2020 at 12:10 Comment(0)
E
0

Use this link, how_to_setup_postgresql_datasource_with_wildfly.This will solve your problem in alternate ways.

Configuration file edition(One way)

Standalone.xml is the configuration file for the server. The management console is just a friendly UI to edit this file.

Deploy the JDBC driver

  • Open a file explorer and go to /modules/ directory in your Wildfly installation directory.
  • Create folders /org/postgresql/main/. These folder need to match the hierarchy package of the JDBC driver.
  • Copy the JDBC driver into the 'main' directory you have created. In this directory, create a "module.xml" file with this

        <resources>
            <resource-root path="postgresql-42.2.1.jar"/>
            <!-- Make sure this matches the name of the JAR you are installing -->
        </resources>
        <dependencies>
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
        </dependencies>
    </module>
    

Create the datasource - Go to /standalone/configuration directory in your Wildfly installation directory. - Open standalone.xml (it's the default configuration file used by the standalone server) - Search 'datasource' to go to the right part. - In the element, you need to add both for PostgreSQL and

A restart of Wildfly is needed and you can validate your change by testing the connection in the management console.

<drivers>
    <driver name="postgresql" module="org.postgresql">
        <!-- for xa datasource -->
        <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
        <!-- for non-xa datasource -->
        <driver-class>org.postgresql.Driver</driver-class>
    </driver>
</drivers>
<datasources>
    <datasource jndi-name="java:jboss/datasources/StemoDS" pool-name="StemoDS" enabled="true" use-java-context="true">
        <connection-url>jdbc:postgresql://localhost:5432/StemoDS</connection-url>
        <driver>postgresql</driver>
        <security>
            <user-name>postgres</user-name>
            <password>admin</password>
        </security>
    </datasource>
</datasources>

Another way Using Wildfly CLI(2 way)

The other way to add datasource is using the console line interface (CLI). Again, the process is divided into two steps.

Deploy the JDBC driver - Go to /bin directory in your Wildfly installation directory. - Open a terminal on this directory and run

  ./jboss-cli.sh --connect controller=127.0.0.1 (or jboss-cli.bat if you are on Windows)
  • To install the module, run this command

    module add --name=org.postgresql --resources=/tmp/postgresql-42.2.1.jar --dependencies=javax.api,javax.transaction.api

  • Create the datasource The driver creation is done with this command

    /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgresql",driver-class-name=org.postgresql.Driver)

  • And then, the last command to add the datasource

    data-source add --jndi-name=java:jboss/datasources/StenusysDemoDS --name=StenusysDemoDS --connection-url=jdbc:postgresql://localhost:5432/StenusysDemo --driver-name=postgres --user-name=postgres --password=admin

You can validate your change by testing the connection in the management console.

Exhaustive answered 29/1, 2020 at 6:0 Comment(0)
I
0

I had the same problem, but the solution that I did was create a console user with password using alphanumeric and 1 non-alphanumeric character.

  1. run the server wildfly phat\bin\standalone.bat
  2. wildfly phat\bin\add-user.bat
  3. press a if manager console
  4. username: admin or enter your user name you want
  5. press a fo update admin user
  6. password: for example p@ssword1 or your password with 1 non-aphanumeric character
  7. repassword: the same password you used
  8. enter
  9. no and enter

and finally use web browser different like chrome

Config user with password without 1 non-aphanumeric character

Config user with password with 1 non-aphanumeric character

Ithyphallic answered 22/3, 2020 at 23:35 Comment(1)
How having a password formatted like that solves that problem?Incredulity
R
0

If the problem remains after updating HAL console version, then change jboss.management.http.port (in configuration/standalone.xml) from 9990 to 9991.

Rowlett answered 10/8, 2023 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.