java - Not able to create mysql datasource in Jboss 7.1.1 -
i using jboss 7.1.1 final
release. trying add mysql driver
server via admin console. able when go create datasources, not find driver listed there. followed steps add driver server mentioned in link : http://www.appeon.com/support/documents/appeon_online_help/1.5/server_configuration_guide_for_j2ee/ch03s03s03.html#d0e4128
i followed step 3 of installing jdbc driver via web console had created 1 management user.to summarize did,
i added driver file
e:\devsoftwares\servers\jboss\jboss-as-7.1.1.final\modules\com\mysql\main\meta-inf\services\java.sql.driver
, content following :com.mysql.jdbc.jdbc2.optional.mysqlxadatasource
(fully qualified driver class name).create module.xml file inside
e:\devsoftwares\servers\jboss\jboss-as-7.1.1.final\modules\com\mysql\main\
, content below :added
mysql-connector-java-5.0.8-bin.jar
file insidee:\devsoftwares\servers\jboss\jboss-as-7.1.1.final\modules\com\mysql\main\
ran
jar -uf mysql-connector-java-5.0.8-bin.jar
meta-inf\services\java.sql.driver
command modify jar. after running command seeservices\java.sql.driver
file driver class name given in step 1 inside meta-inf folder of jar file not there before running command.
i picked qualified name of driver class mysql jboss 7.x below link : http://www.appeon.com/support/documents/appeon_online_help/1.5/server_configuration_guide_for_j2ee/ch03s03s07.html#d0e5769
i able figure out causing problem, when try enable deployed jar exception in server console stating : unable instantiate driver class com.mysql.jdbc.jdbc2.optional.mysqlxadatasource
:
java/lang.classcastexception : com.mysql.jdbc.jdbc2.optional.mysqlxadatasource.
however checked mysql-connector-java-5.0.8-bin.jar
, able find driver class mentioned above in same directory structure classes qualified name.
i not able figure out why getting exception or doing wrong during setup causing issue.the platform using windows. 1 please me it.
note : content of module.xml
<?xml version="1.0" encoding="utf-8"?> <module xmlns="urn:jboss:module:1.0" name="com.mysql"> <resources> <resource-root path="mysql-connector-java-5.0.8-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>`
please check have added mysql datasource configuration in standalone.xml
or in equivalent xml file:-
<subsystem xmlns="urn:jboss:domain:datasources:1.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</connection-url> <driver>h2</driver> <security> <user-name>sa</user-name> <password>sa</password> </security> </datasource> <datasource jndi-name="java:jboss/datasources/mysqlexampleds" pool-name="mysqlexampleds" enabled="true" use-java-context="true"> <connection-url>jdbc:mysql://localhost:3306/jboss7db</connection-url> <driver>mysql</driver> <pool> <max-pool-size>30</max-pool-size> </pool> <security> <user-name>root</user-name> <password>admin</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>
Comments
Post a Comment