I have added below profile in \standalone\configuration\Standalone-full.xml but still not done with mysql db.
I added jbpmDS as mysql data source but still jbpm not going to use this one, both datasources are valid and connect as I confirmed from admin console.
If I remove ExampleDS data source then its getting failed totally as ExampleDS is required and mandatory as I get reference from other community forum. Please suggest if anybody have configured same earlier.
<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 jndi-name="java:jboss/datasources/jbpmDS" pool-name="jbpmDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>root</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.mysqldatabase.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
Add below system properties in standalone-full.xml file,
<system-properties>
<property name="org.kie.server.persistence.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="org.kie.server.persistence.ds" value="java:jboss/datasources/jbpmDS"/>
</system-properties>
I was facing the same issue.
Fixed it by adding system-properties in standalone.xml-
<system-properties>
<property name="org.kie.server.persistence.dialect"
value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="org.kie.server.persistence.ds"
value="java:jboss/datasources/jbpmDS"/>
</system-properties>
Make Sure you have added mysql connector jar and module.xml in below path \modules\system\layers\base\com\mysqldatabase\mysql\main
module.xml
<module xmlns="urn:jboss:module:1.5" name="com.mysqldatabase.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.38.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
Related
I'm using Jboss EAP 7.1 now, recently I add the Oracle datasource to the server as the datasource I correctly configured before. But I got the error message:
Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.CreditDS is missing [jboss.jdbc-driver.oracle11g]"
CreditDs is my JNDI name and oracle11g is the driver name. Here are my configuration:
<!-- standalone.xml -->
<datasource jndi-name="java:jboss/datasources/CreditDS" pool-name="CreditDS" enabled="true">
<connection-url>jdbc:oracle:thin:#***</connection-url>
<driver>oracle11g</driver>
…… …… ……
</datasource>
<drivers>
<driver name="oracle11g" module="com.oracle.ojdbc14">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
Here is the modules.xml in modules/com/oracle/ojdbc14/main
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc14">
<resources>
<resource-root path="ojdbc14-10.2.0.4.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
What's wrong?
I guess your oracle module is not recognized correctly.
The procedure for adding oracle JDBC module is as follows:
1 create folder com/oracle/ojdbc14/10.2.0.4.0 withing JBOSS_HOME/modules directory
2 copy your oracle jar file to the folder and add a module.xml with the following contents
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.oracle.ojdbc14" slot="10.2.0.4.0">
<resources>
<resource-root path="ojdbc14-10.2.0.4.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
3 Create driver definition in standalone.xml
<driver name="oracle14" module="com.oracle.ojdbc14:10.2.0.4.0">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
Couple of things to note:
Do pay attention to correct version of JBoss modules XMLNS - you tagged your questions with EAP7 - so you should use xmlns 1.3.
Note the slot value in both modules.xml and driver definition. This could be any value, but it is a good practice to use the lib version.
After adding any modules into JBoss, you need to restart it completely(restart JVM).
Lastly, you should use an up-to-date version of Oracle JDBC driver as ojdbc14 are not supported anymore, so it should be like this:
Module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.oracle.ojdbc7" slot="12.1.0.2">
<resources>
<resource-root path="ojdbc7-12.1.0.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
Folder modules/com/oracle/ojdbc7/12.1.0.2
Driver:
<driver name="oracle7" module="com.oracle.ojdbc7:12.1.0.2">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
I know this has been asked so many times but still I couldn't find a solution to it. I am using JPA + Hibernate provider + MySQL in my spring mvc project. When I deploy it to Tomcat, it executes with no problem. Then when I move it to JBoss 7.1.1. it throws me No suitable Driver found exception.
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test
So I narrow this down to JBoss.
This is my persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="personDB">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.springapp.modlels.OfficeEntity</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="9ijn)OKM"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
and this is my calling code
EntityManagerFactory emf = Persistence.createEntityManagerFactory("personDB");
EntityManager mgr = emf.createEntityManager();
mgr.getTransaction().begin();
OfficeEntity officeEntity = new OfficeEntity();
officeEntity.setOfficeName("test");
mgr.persist(officeEntity);
mgr.getTransaction().commit();
It looks like the JBoss cannot find the suitable driver when getTransaction() get called. And my driver is
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.1.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
</dependency>
UPDATED:David Levesque suggested me to install the JDBC driver to JBoss.
This is what i did in \modules\com\mysql\main, I copied mysql-connector-java-5.1.21.jar here and created the module.xml,
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.21.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
I also modified the \standalone\configuration\standalone.xml
<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</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="false" jndi-name="java:/mysqldb" pool-name="my_mysl" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>9ijn)OKM</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</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"/>
</drivers>
</datasources>
And I also tested the datasource in JBoss console and it connects succesfully.
But I am sorry, by adding this, it still shows me the same exception.
Please help, Thank you.
Your hibernate configuration is fine for jboss, but i think you missed the one part to configure hibernate with jboss.
1) So please add the dependencies <module name="com.mysql"/> in the module.xml in the
jboss-as-7.1.1.Final\modules\org\hibernate\main\module.xml
2) Create the correct data source in your standalone.xml
<datasource jta="false" jndi-name="java:jboss/datasources/mysqldb" pool-name="my_mysl" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>9ijn)OKM</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
3) Remove the following properties from persistence.xml
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="9ijn)OKM"/>
Except these your configuration is right but please correct your peaces of code with above changes. Your error will resolve...
For the reference, you can follow this link Configure hibernate in jboss 7.1.1
Thank you...
Hi,
I've setup a datasource in jboss standalone.xml and trying to access the datasource. The app doesn't start siting errors from my web.xml configurations.
Have been getting this error, no matter the change in settings:
{"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.module.myapp.myapp.env.myDataSource is missing [jboss.naming.context.java.jboss.datasources.myDataSource]
]}}}
Here is my web.xml
<resource-ref>
<description>SQL Server Spring JNDI Datasource </description>
<!-- res-ref-name>jdbc/myDataSource</res-ref-name-->
<res-ref-name>myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<lookup-name>java:jboss/datasources/myDataSource</lookup-name>
</resource-ref>
Here is my setting in standalone.xml
<datasources>
<datasource jndi-name="java:jboss/datasources/myDataSource" pool-name="myDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://10.0.0.0:1433;DatabaseName=my_Local</connection-url>
<driver>mssql</driver>
<security>
<user-name>user</user-name>
<password>user1</password>
</security>
</datasource>
<drivers>
<driver name="mssql" module="com.microsoft">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
I've copied the SQL server jdbc jar file to $jbosshome/modules/com/microsoft/main
and added a module.xml
<module xmlns="urn:jboss:module:1.1" name="com.microsoft"><resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Any help is greatly appreciated.
-vg
Remote lookup of datasources is not supported in AS7.
Similar question has been answered here
I work on a Java EE web application, I use Eclipse Indigo as IDE, JBoss 7.1 as application server and Oracle 10j as Database.
I created this directory modules\oracle\jdbc\driver\main in the home folder of JBoss 7.1 and I add the Oracle driver and the file module.xml.
The contents of the module.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="oracle.jdbc.driver">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
I've done all the necessary configuration on the file server standalone.xml.
The contents of the standalone.xml file is as follows:
<datasources>
<datasource jndi-name="java:jboss/datasources/EmnaDS" pool-name="11gDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#//localhost:1521/XE</connection-url>
<driver>oracle</driver>
<pool>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>bct</user-name>
<password>emna</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="oracle.jdbc.driver">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
I created an EJB project in eclipse, I add the JPA facet.
The contents of the persistence.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="BCTProjet">
<jta-data-source>java:jboss/datasources/EmnaDS</jta-data-source>
<class>com.bct.entity.utilisateur</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create" />
</properties>
</persistence-unit>
</persistence>
When I add the project on the server and I run it, I have this result:
14:17:58,198 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) JBAS010400: Bound data source [java:jboss/datasources/EmnaDS]
14:17:58,267 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 9404ms - Started 135 of 206 services (70 services are passive or on-demand)
But the project is not deployed on the server and I could not see generated tables for the classes in the database?
The log is too few to identify the problem. But your datasource is ok. I think something is wrong with your app. Or it doesn't deploy at all.
I run jboss in standalone mode and have set my datasource in the standalone.xml to the following:
<datasource jndi-name="MyDenaliDS" pool-name="MyDenaliDs_Pool" enabled="true" jta="true"
use-java-context="true" use-ccm="true">
<connection-url>
jdbc:sqlserver://myip:1433;databaseName=mydb;integratedSecurity=true
</connection-url>
<driver>
sqljdbc
</driver>
<security>
<user-name>
username
</user-name>
<password>
password
</password>
</security>
</datasource>
<drivers>
<driver name="sqljdbc" module="com.microsoft.sqlserver.jdbc">
<driver-class>
com.microsoft.sqlserver.jdbc.SQLServerDataSource
</driver-class>
</driver>
</drivers>
in the folder %jbosshome%\modules\com\microsoft\sqlserver\jdbc\ I have the sqljdb4.jar and the following module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module name="com.microsoft.sqlserver.jdbc" xmlns="urn:jboss:module:1.0">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
When I start the jboss it gives me the following error:
> New missing/unsatisfied dependencies: service
> jboss.jdbc-driver.sqljdbc (missing)
Anyone know what I've done incorrect or what I'm missing?
using Jboss AS 7.1.1, as well as putting the module in %jbosshome%\modules\com\microsoft\sqlserver\jdbc\main I had to make a slight change to the xml - the driver element in standalone.xml should be :
<driver name="sqljdbc" module="com.microsoft.sqlserver.jdbc">
<driver-class>
com.microsoft.sqlserver.jdbc.SQLServerDriver
</driver-class>
</driver>
and the module.xml should be:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver.jdbc">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
With Jboss 7.1.1 I managed to get it working without specifying module.
Just put sqljdbc4.jar into deployment directory:
%JBOSSHOME%\standalone\deployments
Configuration needed for datasource in standalone.xml is as follows:
<datasource jndi-name="java:jboss/datasources/myPool" pool-name="myPool" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://127.0.0.1:1433;databaseName=myName;</connection-url>
<driver>sqljdbc4.jar</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>myUser</user-name>
<password>myPassword</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
got the same error like you before
instead of %jbosshome%\modules\com\microsoft\sqlserver\jdbc\
try %jbosshome%\modules\com\microsoft\sqlserver\jdbc\main
and put the .jar of the jdbc driver and the module.xml overthere.
I used this configuration and it worked OK on AS7
<datasource jndi-name="java:jboss/datasources/stagingDS" pool-name="stagingDS" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://linp-sqlrpt-01;databaseName=pmdm</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver</driver>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
</datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft.jdbc">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>
</drivers>
Of course if you're not using the distributed DataSource you can configure the regular driver class as previously defined.
The module file looks like this.
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.jdbc">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Deploying JDBC jar file (e.g. sqljdbc41.jar) by admin console should allow to select and use it when defining a new data source.
this is the work for me.
in JBOSS 7, MSSQL JDBC driver 6, type 4, file name:sqljdbc42.jar
Install the driver name:sqljdbc42.jar in [JBoss HOME]\modules\com\microsoft\main
add under the same directory module.xml with content below
<module xmlns="urn:jboss:module:1.1" name="com.microsoft">
<resources>
<resource-root path="sqljdbc42.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
insert datasource definition to standalone.xml in block <subsystem xmlns="urn:jboss:domain:datasources:4.0"> <datasources> as below
<datasource jta="true" jndi-name="java:jboss/datasources/iwebDS" pool-name="MSSQLDS" enabled="true" use-ccm="true">
<connection-url>jdbc:sqlserver://172.24.17.52:1803;DatabaseName=IWEB_IWEBSIT</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver2008</driver>
<pool>
<min-pool-size>10</min-pool-size>
<initial-pool-size>10</initial-pool-size>
<max-pool-size>100</max-pool-size>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>[sqlserver user]</user-name>
<password>[sqlserver password]</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
<background-validation>true</background-validation>
</validation>
</datasource>
insert driver definition to standalone.xml in block <subsystem xmlns="urn:jboss:domain:datasources:4.0"> <drivers> as below
<driver name="sqlserver2008" module="com.microsoft">
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
</driver>
ps: "sqlserver2008" is the name as you wish.