connection - MySQL WildFly integration -
com/mysql/main/module.xml
, put mysql-connector-jar
here:
<?xml version="1.0" encoding="utf-8"?> <module xmlns="urn:jboss:module:1.3" name="com.mysql"> <resources> <resource-root path="mysql-connector-java-5.1.33-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
datasource , driver in standalone.xml
<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> <datasource jndi-name="java:/mysqlds" pool-name="mysqlds" enabled="true" use-java-context="true"> <connection-url>jdbc:mysql://localhost:3306/db3</connection-url> <driver>mysqldriver</driver> <security> <user-name></user-name> <password></password> </security> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.jdbcdatasource</xa-datasource-class> </driver> <driver name="mysqldriver" module="com.mysql"> <driver-class>com.mysql.jdbc.driver</driver-class> </driver> </drivers> </datasources> </subsystem>
persistence.xml
<?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <!-- mysql datasource --> <persistence-unit name="jpadb"> <jta-data-source>java:/mysqlds</jta-data-source> <properties> <property name="showsql" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.mysqldialect" /> </properties> </persistence-unit> </persistence>
and getting
ij000604: throwable while attempting new connection: null: javax.resource.resourceexception: not create connection
error when run wildfly 8.
Comments
Post a Comment