Error when configuring MariaDB driver on Wildfly server - java

I am trying to configure a MariaDB datasource on Wildfly. This seems like it should be a simple operation, but I can't seem to get the datasource module to load properly. I have added the maria-java-client-1.1.8.jar archive and a module.xml file to the wildfly-8.2.0.Final/modules/com/mariadb/main directory. The module.xml file is as follows:
<module xmlns:"urn:jboss:module:1.1" name="com.mariadb">
<resources>
<resource-root path="mariadb-java-client-1.1.8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
I have also added a driver entry to the standalone.xml file as follows:
<subsystem xmlns="urn:jboss:domain:datasources:2.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mariadb" module="com.mariadb"/>
</drivers>
</datasources>
</subsystem>
Note that I have only included the driver entry for now. I will add the datasource entry after I get the module to load properly.
Now when I startup the server I get the following error:
14:14:46,570 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 26) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mariadb")
]) - failure description: "JBAS010441: Failed to load module for driver [com.mariadb]"
According to everything that I have read, this is the proper way to configure the driver, but it is not working for me. Does anyone know what I am doing wrong?
Thanks in advance for your help!

The first line of your module.xml has a typo (you use a colon instead of equals in xmlns=...):
Your version:
<module xmlns:"urn:jboss:module:1.1" name="com.mariadb">
Correct version:
<module xmlns="urn:jboss:module:1.3" name="com.mariadb">

Related

How to switch from default H2 DB of jBPM to another Database like MariaDB?

I've installed MariaDB connector in jBPM 7.53 Final with .jar file and configured MariaDB database locally. Checked in management console and saw that datasources and JDBC connectors look good (MariaDBDS is enabled), but an error showing in runtime "Boot errors occurred during the start of server".
Failure description: {"WFLYCTL0412: Required services that are not
installed:" =>
["jboss.jdbc-driver.mariadb-java-client-2_7_1_jar"],"WFLYCTL0180:
Services with missing/unavailable dependencies" =>
["jboss.driver-demander.java:jboss/MariaDBDS is missing
[jboss.jdbc-driver.mariadb-java-client-2_7_1_jar]","org.wildfly.data-source.MariaDBDS
is missing [jboss.jdbc-driver.mariadb-java-client-2_7_1_jar]"]}
Missing dependencies: jboss.driver-demander.java:jboss/MariaDBDS is
missing [jboss.jdbc-driver.mariadb-java-client-2_7_1_jar]
org.wildfly.data-source.MariaDBDS is missing
[jboss.jdbc-driver.mariadb-java-client-2_7_1_jar]
I have configured MariaDB Java connector in the jBPM standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:5.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mariadb://localhost:3306/mysql</connection-url>
<driver-class>org.mariadb.jdbc.Driver</driver-class>
<driver>mariadb-java-client-2.7.1.jar</driver>
<security>
<user-name>root</user-name>
<password>admin</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="mariadb" module="org.mariadb">
<xa-datasource-class>org.mariadb.jdbc.MariaDbDataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
and I have copied the MariaDB Java connector to JBPM_HOME/modules/com/mariadb/main/mariadb-java-client-2.7.1.jar and configured the module.xml like this:
<module xmlns="urn:jboss:module:1.1" name="org.mariadb">
<resources>
<resource-root path="mariadb-java-client-2.7.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Also, in Business-Central to new process instance appeared this attention:
enter image description here
What I am missing or change in these steps? Any idea if jBPM works with the external DB or not?
#KrenarR have you set up these properties under system-properties as well?
<property name="org.kie.server.persistence.ds" value="java:jboss/MariaDBDS"/>
<property name="org.kie.server.persistence.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
You can also add the driver as a core module by means of jboss_cli:
module add --name=org.mariadb --resources=mariadb-java-client-2.7.1.jar --dependencies=javax.api,javax.transaction.api
Also check this line in the datasource:
<driver>mariadb-java-client-2.7.1.jar</driver>
I think it should be just the driver name you have defined:
<driver>mariadb</driver>
You can refer to the documentation Switch to another database
from jbpm.org for detailed steps.

Java EE and JBOoss EAP 6.3

I'm new to the JBoss application server and I tried to add a datasource for an Oracle db in JBoss EAP6.3. But I am getting the error below and seeing error while 'Testing a db connection in server'.
Please let me know if I have missed something.
Step 1-> Added below datasource in standalone.xml file
Step 2-> Created a module.xml file and placed under \modules folder as com\oracle\main
Here is my module.xml file
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Step 3-> Copied a ojdbc6.jar file in the com\oracle\main location.
Step 4-> Started the server by standalone.bat file
<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#localhost:1521:XS</connection-url>
<driver>oracle</driver>
<security>
<user-name>system</user-name>
<password>system</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle">
<xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>
</driver>
</drivers>
Error on console:
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "OracleDS")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
"rolled-back" => true
}
please help me out how to create a connection ,
Thanks in advance
Place your ojdbc6.jar in $JBOSS_HOME/modules/system/layers/base/oracle/jdbc/main/ along with your module.xml.
The path where you have placed your ojdbc6.jar and module.xml is not
correct.
It should be modules/system/layers/base/com/oracle/main
Also define the data-source definition like:-
<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#localhost:1521:XS</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle</driver>
<security>
<user-name>system</user-name>
<password>system</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle"/>
</driver>
</drivers>

Add new Datasource (mysql) wildfly

I'm trying to add new datasource mysql jdbc driver to my wildfly server
I created folder wildfly.x.x.x/modules/system/layers/base/com/mysql/main
I've got here jdbc jar file and module.xml
<module xmlns="urn:jboss:module:1.3" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.34-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
then added dataresource code into standalone-full.xml (under datareources tag)
<datasource jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySQLDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver>MySQLDriver</driver>
<security>
<user-name>root</user-name>
<password></password>
</security>
</datasource>
but when i go to wildfly control panel http://localhost:9990/console/
dataresource doesnt appear , what did i missed?
also i'm trying to add it manually from interface i'v got this error
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "mysql")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
"rolled-back" => true
}
Did you add a driver definition? Your datasources subsystem should look something like this:
<subsystem xmlns="urn:jboss:domain:datasources:2.0">
<datasources>
<datasource jndi-name="java:/jdbc/myds" pool-name="myds" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost/mydb</connection-url>
<driver>mysql</driver>
<security>
<user-name>foo</user-name>
<password>bar</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
The driver element in the data source definition must reference a driver element by name. The module attribute must match the name of your MySQL driver module.
Actually I meet the same problem (I could add the datasources and test connection successfully before) So I'm just confused and I find a way works for me:)
See my services and I find it stopped,and I started it then tried again,It works well again! Even though your service does not stop, maybe just restart it.
I have to say it may not work for you if you never success to connect before,good luck~
There are three ways using which you can simply create datasource into wildfly
Using admin console
Manually adding into standalone.xml
Creating datasource file that is xml file.
Go to WildFly directory/standalone/deployments
Simplest way to create datasource xml with following content
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="APP_DS" pool-name="APP_DS" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/DB_NAME</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<!-- sql to call when connection is created -->
<new-connection-sql>SELECT 1</new-connection-sql>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<!-- sql to call on an existing pooled connection when it is obtained from pool -->
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
</validation>
<timeout>
<blocking-timeout-millis>300000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>true</track-statements>
</statement>
</datasource>
</datasources>
Also create the database that you will use. Sometimes the reason for this error is that the database is missing.

Upgrade to JBoss 7 Datasource is Not Working

I am trying to upgrade to JBoss 7; however, my datasource is not creating a connection. I did not deploy any WAR files. I am testing the connection by using the admin console. In standalone.xml, I configured the datasource as follows:
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="false" jndi-name="java:jboss/projectDS" pool-name="projectDS" enabled="true">
<connection-url>jdbc:oracle:thin:#mcc-67-150.usae.ABC.com:1521:test</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>ojdbc6</driver>
<security>
<user-name>XXX</user-name>
<password>XXX</password>
</security>
</datasource>
<drivers>
<driver name="ojdbc6" module="com.oracle" />
</drivers>
</datasources>
</subsystem>
The ojdbc6.jar driver is in the following folder %JBOSS_HOME%\modules\com\oracle\main. The entry in my module.xml reads as follows:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
The error that I receive in my server log when I test the connection from the admin console is:
07:47:11,863 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
(HttpManagementService-threads - 4) IJ000604: Throwable while attempting to get
a new connection: null: javax.resource.ResourceException: Could not create conne
ction
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLo
calManagedConnection(LocalManagedConnectionFactory.java:277) [ironjacamar-jdbc-1
.0.9.Final.jar:1.0.9.Final]
Thanks in advance!
Deploy the oracle driver jar to jboss from the console. Its something like localhost:9990/console with credential test/test123
From the datasource option, check whether you can see your datasource java:jboss/hqiis over there or not. If not, try to create the datasource from the console instead of configuring through xml.
Also check the data source status from the jboss-cli:
a. From command prompt, enter into JBOSS_HOME\bin
b. Type connect YOUR_IP:YOUR_PORT (example 192.169.1.10:9999)
c. Type this to see whether your datasource is available or not:
/subsystem=datasources/data-source=hqiis:test-connection-in-pool
You should see a msg like below if you are having a configured datasource named hqiis
connection-in-pool
{
"outcome" => "success",
"result" => [true]
}

Unable to define oracle datasource on Jboss AS 7

I'm using Jboss AS 7.1.1.final and I'm trying to add an oracle Datasource:
<datasource jndi-name="java:jboss/datasources/DefaultDS"
pool-name="DefaultDS"
enabled="true"
use-java-context="true">
<connection-url>jdbc:oracle:oci#TNS_NAME</connection-url>
<driver>oracle</driver>
<security>
<user-name>username</user-name>
<password>pwd</password>
</security>
</datasource>
And the driver:
<driver name="oracle" module="com.oracle.ojdbc">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
But when I start the server I get:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.oracle (missing) dependents: [service jboss.data-source.java:jboss/datasources/DefaultDS]
I have a module under modules/com/oracle/ojdbc/main:
<module xmlns="urn:jboss:module:1.0" name="com.Oracle.ojdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
and of course the jar is there.
Can someone please tell me what am I doing wrong here?
Add this to define driver: for xa datasource
<driver name="oracleDriver" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.OracleXADataSource</xa-datasource-class>
</driver>
for non-xa-------
<driver name="oracleDriver" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</driver>
Got the answer:
In the drivers section, I defined the driver as sitting in module "com.oracle.ojdbc" but the module itself is actually defined with capital 'O' in 'Oracle' so it should be "com.Oracle.ojdbc"
Add this to define driver: for xa datasource
<driver name="oracleDriver" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.OracleXADataSource
for non-xa-------
<driver name="oracleDriver" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</driver>
Path for the ojdbc jar in my case was : D:\ProgramFiles\JBoss6.4\modules\com\oracle\jdbc7\main where D:\ProgramFiles\JBoss6.4\ is the JBOSS HOME directory.
in the main folder, need to have following files.
ojdbc7.jar
module.xml
Entry for Module would look like below:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.jdbc7">
<properties>
<property name="jboss.api" value="unsupported"/>
</properties>
<resources>
<resource-root path="ojdbc7.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
You can define datasource from admin interface, find good tutorial below
http://middlewaremagic.com/jboss/?p=350

Categories