Configure HSQLDB datasource with Thorntail / Wildfly Swarm - wildfly

I have a problem with thorntail / wildfly.
I am trying to declare hsql driver and i don't success.
Thorntail says me:
2022-08-24 15:48:08,912 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 35) WFLYCTL0013: L'op�ration ("add") a �chou� - adresse : ([
("subsystem" => "datasources"),
("jdbc-driver" => "org.hsqldb")
I guess I put wrong values in datasources / jdbc-drivers.
But what are the right values ?
Here's the extract of configuration:
swarm:
logging: INFO
http:
port: 8080
datasources:
jdbc-drivers:
org.hsqldb:
driver-class-name: org.hsqldb.jdbc.JDBCDriver
xa-datasource-class-name: org.hsqldb.jdbc.pool.JDBCXADataSource
driver-module-name: org.hsqdb
Thanks,
Stéphne

I found the solution...
Th proble mwas that i had a diffrence between the file module.xml and the driver-module-name attribute like this: one character was missing.
module.xml
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="org.hsqldb">
<resources>
<resource-root path="hsqldb-2.7.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
And :
swarm:
logging: INFO
http:
port: 8080
datasources:
jdbc-drivers:
org.hsqldb:
driver-class-name: org.hsqldb.jdbcDriver
xa-datasource-class-name: org.hsqldb.jdbc.pool.JDBCXADataSource
driver-module-name: org.hsqdb
That was all.... ;-)
Stéphane

Related

PostgreSQL 13 + Hibernate 6.0.2 + wildfly-preview-27.0.0.Alpha5 Error

I have to configure my PostgreSQL datasource for WildFly in order to use it in my Jakarta EE 10 with hibernate 6.0.2
Below shown are my configuration
Postgresql module in widfly
<?xml version="1.0" ?>
<resources>
<resource-root path="postgresql-42.2.5.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
Datasource
<datasource jndi-name="java:jboss/datasources/nextu" pool-name="nextu">
<connection-url>jdbc:postgresql://localhost:5432/nextu</connection-url>
<driver>postgres</driver>
<security>
<user-name>nextu</user-name>
<password>nextu</password>
</security>
</datasource>
Driver used
org.postgresql.Driver
Persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
version="3.1">
<persistence-unit name="primary">
<jta-data-source>java:jboss/datasources/nextu</jta-data-source>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<!-- AUTO-GENERATES DATABASE FROM ANNOTATIONS METADATA -->
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.create-source" value="metadata"/>
<property name="javax.persistence.schema-generation.drop-source" value="metadata"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
</properties>
</persistence-unit>
</persistence>
Error I am getting while running:
00:50:49,304 ERROR [org.jboss.msc.service.fail] (ServerService
Thread Pool -- 80) MSC000001: Failed to start service
jboss.persistenceunit."servlet-0.0.1-SNAPSHOT.war#primary":
org.jboss.msc.service.StartException in service
jboss.persistenceunit."servlet-0.0.1-SNAPSHOT.war#primary":
java.lang.ExceptionInInitializerError at
org.jboss.as.jpa#27.0.0.Alpha5//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:199)
at
org.jboss.as.jpa#27.0.0.Alpha5//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:129)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at
org.wildfly.security.elytron-base#2.0.0.Beta3//org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:664)
at
org.jboss.as.jpa#27.0.0.Alpha5//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:214)
at
org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at
org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at
org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at
org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:833) at
org.jboss.threads#2.4.0.Final//org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: java.lang.ExceptionInInitializerError at
org.hibernate#6.0.2.Final//org.hibernate.dialect.PostgreSQLDialect.contributeTypes(PostgreSQLDialect.java:1107)
at
org.hibernate#6.0.2.Final//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:374)
at
org.hibernate#6.0.2.Final//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:144)
at
org.hibernate#6.0.2.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
at
org.hibernate#6.0.2.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
at
org.hibernate.jipijapa-hibernate6#27.0.0.Alpha5//org.jboss.as.jpa.hibernate.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:45)
at
org.jboss.as.jpa#27.0.0.Alpha5//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:171)
... 10 more Caused by: java.lang.RuntimeException: Could not
initialize PostgreSQLPGObjectJdbcType at
org.hibernate#6.0.2.Final//org.hibernate.dialect.PostgreSQLIntervalSecondJdbcType.<clinit>(PostgreSQLIntervalSecondJdbcType.java:78)
... 17 more Caused by: java.lang.NoSuchMethodException:
org.postgresql.util.PGInterval.getWholeSeconds() at
java.base/java.lang.Class.getDeclaredMethod(Class.java:2675) at
org.hibernate#6.0.2.Final//org.hibernate.dialect.PostgreSQLIntervalSecondJdbcType.<clinit>(PostgreSQLIntervalSecondJdbcType.java:74)
... 17 more
00:50:49,307 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed -
address: ([("deployment" => "servlet-0.0.1-SNAPSHOT.war")]) -
failure description: {"WFLYCTL0080: Failed services" =>
{"jboss.persistenceunit."servlet-0.0.1-SNAPSHOT.war#primary"" =>
"java.lang.ExceptionInInitializerError Caused by:
java.lang.ExceptionInInitializerError Caused by:
java.lang.RuntimeException: Could not initialize
PostgreSQLPGObjectJdbcType Caused by: java.lang.NoSuchMethodException:
org.postgresql.util.PGInterval.getWholeSeconds()"}} 00:50:49,360 INFO
[org.jboss.as.server] (ServerService Thread Pool -- 46) WFLYSRV0010:
Deployed "servlet-0.0.1-SNAPSHOT.war" (runtime-name :
"servlet-0.0.1-SNAPSHOT.war") 00:50:49,361 INFO
[org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183:
Service status report WFLYCTL0186: Services which failed to start:
service jboss.persistenceunit."servlet-0.0.1-SNAPSHOT.war#primary":
java.lang.ExceptionInInitializerError WFLYCTL0448: 11 additional
services are down due to their dependencies being missing or failed
00:50:49,408 INFO [org.jboss.as.server] (Controller Boot Thread)
WFLYSRV0212: Resuming server 00:50:49,410 ERROR [org.jboss.as]
(Controller Boot Thread) WFLYSRV0026: WildFly Preview 27.0.0.Alpha5
(WildFly Core 19.0.0.Beta15) started (with errors) in 9738ms - Started
412 of 658 services (13 services failed or missing dependencies, 362
services are lazy, passive or on-demand) - Server configuration file
in use: standalone.xml
I found the solution, I had PostgreSQL dependencies in my pom maven.This is the code added.
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.postgres</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
NB : org.postgres => the name of my module Postgres previously define in widfly.

Oracle DB Connection: failure description: "WFLYJCA0041: Failed to load module for driver [com.oracle]

Setting up connection to Oracle19C from Keycloak 12.0.3
Receiving message: "failure description: "WFLYJCA0041: Failed to load module for driver [com.oracle]"
I've relooked x100 and can't seem to find what is missing. Could any kind soul review the below for what I have missed?
JAR File path:
/modules/system/layers/keycloak/com/oracle/main
module.xml
ojdbc10.jar
standalone.xml
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:oracle:thin:#DBURL:1521:SID</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>USER</user-name>
<password>PASSWORD</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<background-validation>true</background-validation>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
</validation>
<timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
<driver name="oracle" module="com.oracle">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
module.xml
<?xml version=”1.0" ?><?xml version='1.0' encoding='UTF-8'?>
<module xmlns=”urn:jboss:module:1.3" name=”com.oracle”>
<resources>
<resource-root path=”ojdbc10.jar”/>
</resources>
<dependencies>
<module name=”javax.api”/>
<module name=”javax.transaction.api”/>
</dependencies>
</module>
I had this issue, and the only way I could solve it was to place the oracle driver in the keycloak/modules directory.
These did not work:
keycloak/modules/system/layers/keycloak/com/oracle It is here that is described in the KeyCloak documentation, and it worked for me for Postgres, but I could not get the oracle driver to load from here.
keycloak/modules/system/layers/base/com/oracle : Tried this out of desperation.
But this worked for me in:
keycloak/modules/com/oracle
keycloak/modules/com/oracle/main/module.xml
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle">
<resources>
<resource-root path="ojdbc8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
And the ojdbc8.jar file was also in this directory.
NOTE: The name="com.oracle" has to match the path com/oracle in the module directory.
In the standalone.xml file, I added the following datasource.
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#hostname:1521:SID</connection-url>
<driver>oraclejdbc</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
</datasource>
With the matching driver
<driver name="oraclejdbc" module="com.oracle">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
NOTE:
the module="com.oracle" matches the path com/oracle.
the driver name="oraclejdbc" matches the <driver>oraclejdbc</driver> element.
Once working, I saws this in the log.
2021-05-31 14:46:17,376 INFO [org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory] (ServerService Thread Pool -- 60) Database info: {databaseUrl=jdbc:oracle:thin:#server:1521:SID, databaseUser=user, databaseProduct=Oracle Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.10.0.0.0, databaseDriver=Oracle JDBC driver 19.3.0.0.0}
But prior to it working I would see the following errors in the log (which I am including, incase people are googling the error message)
2021-05-31 14:47:12,049 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 50) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "oraclejdbc")
]) - failure description: "WFLYJCA0115: Module for driver [com.oracle] or one of it dependencies is missing: [com.oracle]"
Or this error
2021-05-31 14:47:14,962 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "KeycloakDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oraclejdbc"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.KeycloakDS is missing [jboss.jdbc-driver.oraclejdbc]",
"jboss.driver-demander.java:jboss/datasources/KeycloakDS is missing [jboss.jdbc-driver.oraclejdbc]"
]
}
Adde module via commandline.
module add --name=oracle.jdbc --resources=customization/ojdbc10.jar --dependencies=javax.transaction.api
Created under the following structure:
-keycloak
--modules
----oracle
------jdbc
--------main
----------module.xml
----------ojdbc10.jar

wildfly wont start because of new missing/unsatisfied dependencies

When I try to start my WildFly server, I got this error :
2018-11-17 21:29:55,203 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "org.postgresql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [org.postgresql]"
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "swap")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.driver-demander.java:jboss/datasources/swap is missing [jboss.jdbc-driver.org_postgresql]",
"jboss.data-source.java:jboss/datasources/swap is missing [jboss.jdbc-driver.org_postgresql]"
]}
2018-11-17 21:30:07,625 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "swap")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.driver-demander.java:jboss/datasources/swap is missing [jboss.jdbc-driver.org_postgresql]",
"jboss.data-source.java:jboss/datasources/swap is missing [jboss.jdbc-driver.org_postgresql]",
"jboss.data-source.java:jboss/datasources/swap is missing [jboss.jdbc-driver.org_postgresql]"
]}
And my standalone.xml :
<datasources>
<datasource jndi-name="java:jboss/datasources/swap" pool-name="swap" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://127.0.0.1:5432/swap?useUnicode=yes&characterEncoding=UTF-8</connection-url>
<driver>org.postgresql</driver>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
</datasource>
<drivers>
<driver name="org.postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.Driver</xa-datasource-class>
</driver>
</drivers>
</datasources>
My PostgreSQL module.xml :
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.5.jar"/>
</resources>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
What could be the problem? Please help and Thanks.
Your module.xml is invalid. A <dependencies> tag is missing. Try it with the following:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.5.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
EDIT:
The module.xml file and the postgresql-42.2.5.jar have to be in
C:\wildfly\wildfly-9.0.2.Final\modules\system\layers\base\org\postgresql\main.
It is also recommended to put your modules directly into
C:\wildfly\wildfly-9.0.2.Final\modules\.
So in your case C:\wildfly\wildfly-9.0.2.Final\modules\org\postgresql\main, that can be problem.
For reference, also have a look at the EAP7 Documentation and you should also think about using the jboss-cli.
For configuration of PostgresSQL for WildFly server, you should follow the following steps.
Step 1 : Adding PostgreSQL Module
Create new folder ${wildfly_home}/modules/system/layers/base/org/postgresql/main/ if not exist.
Download Latest Driver Jar via this link => https://jdbc.postgresql.org/download.html and put under the above folder.
Also in that new folder, Create module.xml and put the following config.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.23.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
May be jar version need to update in resource-root.
Step 2 : Update DB configs from standalone.xml
Remove Existing <driver> config and add new config as follow.
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
Remove existing <datasource> config and add new config as follow.
<datasource jndi-name="java:jboss/datasources/PostgresDS" pool-name="PostgresDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://127.0.0.1:5432/swap?useUnicode=yes&characterEncoding=UTF-8</connection-url>
<driver>postgresql</driver>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
</datasource>
Modify default-bindings datasource name to PostgresDS from ExampleDS.
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/PostgresDS" ...
Make sure that you have created your swap database in PostgreSQL database server.
Now, run server and it will be fine.

JBoss : Not able to add datasouce

I am trying to add datasource for IBM DB2 database and it is showing below error
ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DB2DS1")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.db2"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.DB2DS1 is missing [jboss.jdbc-driver.db2]",
"jboss.driver-demander.java:/DB2DS1 is missing [jboss.jdbc-driver.db2]"
]
}
I have below configuration in module.xml which is placed along with database driver in EAP-7.1.0\modules\system\layers\base\com\ibm\db2\main location
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.5" name="com.ibm.db2">
<properties>
<property name="jboss.api" value="unsupported"/>
</properties>
<resources>
<resource-root path="db2jcc.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
Also I think I have successfully installed driver as module because I am seeing it's entry in standalone.xml like
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="db2" module="com.ibm.db2">
<datasource-class>com.ibm.db2.jcc.DB2Driver</datasource-class>
</driver>
</drivers>
What thing I am missing here ?.
To add datasource I am hitting below command from CLI
data-source add --name=DB2DS1--jndi-name=java:/DB2DS1--driver-name=db2 --connection-url=jdbc:db2://localhost:50000/sample
It was a silly mistake I did...
Below is the correct configuration that should be there in standalone.xml
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="db2" module="com.ibm.db2">
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
</driver>
</drivers>
For simplicity I have followed below steps to add db2 datasource
Created module.xml as mentioned in above question
Added database driver for datasource
/subsystem=datasources/jdbc-driver=ibmdb2:add(driver-name=ibmdb2,driver-module-name=com.ibm.db2,driver-class-name=com.ibm.db2.jcc.DB2Driver)
Added datasource to subsystem
data-source add --name=DB2_EFTDEVS1 --driver-name=ibmdb2 --driver-class=com.ibm.db2.jcc.DB2Driver --user-name=Administrator --password=Test#123 --connection-url=jdbc:db2://localhost:50000/sample --jndi-name="java:jboss/datasources/DB2_EFTDEVS1"

Problems creating Wildfly 10 datasource

I am trying to create a datasource in Wildfly 10 to connect with a PostgreSQL 9.5 database, I already saw some tutorials in Internet and still I can't do it.
If someone can help me I will be very thankfull.
This is the error message :enter code here
9:06:46,300 ERROR [org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-6) Error during the deployment of java:jboss/datasources/CiberWebCopierDS: javax.resource.ResourceException: IJ031103: At least one connection property must be defined for datasource-class: org.postgresql.Driver
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createConnectionFactory(LocalManagedConnectionFactory.java:108)
at org.jboss.jca.deployers.common.AbstractDsDeployer.deployDataSource(AbstractDsDeployer.java:772)
at org.jboss.jca.deployers.common.AbstractDsDeployer.createObjectsAndInjectValue(AbstractDsDeployer.java:312)
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer.deploy(AbstractDataSourceService.java:371)
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:149)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
19:06:46,305 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service org.wildfly.data-source.CiberWebCopierDS: org.jboss.msc.service.StartException in service org.wildfly.data-source.CiberWebCopierDS: WFLYJCA0033: Error during the deployment of CiberWebCopierDS
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:163)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:151)
... 5 more
and this
19:06:47,988 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "CiberWebCopierDS")
]) - failure description: {
"WFLYCTL0080: Failed services" => {"org.wildfly.data-source.CiberWebCopierDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.CiberWebCopierDS: WFLYJCA0033: Error during the deployment of CiberWebCopierDS
Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"},
"WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.data-source.CiberWebCopierDS"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
19:06:47,990 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "CiberWebCopierDS")
]) - failure description: {
"WFLYCTL0080: Failed services" => {"org.wildfly.data-source.CiberWebCopierDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.CiberWebCopierDS: WFLYJCA0033: Error during the deployment of CiberWebCopierDS
Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"},
"WFLYCTL0412: Required services that are not installed:" => [
"org.wildfly.data-source.CiberWebCopierDS",
"org.wildfly.data-source.CiberWebCopierDS"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
19:06:48,017 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service org.wildfly.data-source.CiberWebCopierDS: org.jboss.msc.service.StartException in service org.wildfly.data-source.CiberWebCopierDS: WFLYJCA0033: Error during the deployment of CiberWebCopierDS.
This is how I create the module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.h2database.h2">
<resources>
<resource-root path="h2-1.3.173.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
this is the driver definition:
<driver name="postgres" module="org.postgresql">
<datasource-class>org.postgresql.Driver</datasource-class>
</driver>
and this is the datasource definition:
<datasource jndi-name="java:jboss/datasources/CiberWebCopierDS" enabled="true" use-java-context="true" pool-name="CiberWebCopierDS">
<connection-rl>jdbc:postgresql://localhost:5432/CiberWebCopierDB</connection- url>
<driver>postgres</driver>
<security>
<user-name>postgres</user-name>
<password>postgresql</password>
</security>
</datasource
>
The module.xml you provided is not for postgres, it's for a h2 database..
Try using the following module, and remember to download postrgres driver, place it in modules/org/postgresql/main and change "postgresql-Y.X-Z.jdbcV.jar" to the name of the driver you downloaded.
The rest of your config looks good, but I'm not so sure about setting datasource-class in the driver section, I think that goes in the datasource declaration, using driver-class element.
To sum up:
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.postgresql">
<resources>
<resource-root path="postgresql-Y.X-Z.jdbcV.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
driver definition
<driver name="postgres" module="org.postgresql"/>
datasource definition
<datasource jndi-name="java:jboss/datasources/CiberWebCopierDS" enabled="true" use-java-context="true" pool-name="CiberWebCopierDS">
<connection-url>jdbc:postgresql://localhost:5432/CiberWebCopierDB</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgres</driver>
<security>
<user-name>postgres</user-name>
<password>postgresql</password>
</security>
</datasource>
EDIT: As a side note, I think that if you want to declare the datasource class in the driver section, you need to use xa-datasource-class element instead of datasource-class, you can try it if you want.