Thursday, July 21, 2011

introduction to Jboss as 7 and Datasource configuration

Introduction:
1.download jboss as 7 from http://www.jboss.org/jbossas/downloads/
2.study directory stucture by reading user manual
3.there are two deployment mode 1.Domain 2.Standalone

Datasource Configuration:

1)add following code in standalone.xml or domain.xml
subsystem xmlns="urn:jboss:domain:datasources:1.0" ...
datasources
datasource jndi-name="java:/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true"
connection-url
jdbc:mysql://localhost:3306/dbname
/connection-url
driver-class
com.mysql.jdbc.Driver
/driver-class
driver
mysql-connector-java-5.0.6-bin.jar
/driver>
/datasource
drivers
driver name="mysql-connector-java-5.0.6-bin.jar" module="com.mysql"/
/drivers
/datasources
Here...............
mysql-connector-java-5.0.6-bin.jar in this jar not conatain META-INF\services\java.sql.Driver file so
first configure or update jar
i)extract jar , then create empty subdirecory META-INF
ii)then create empty subdirecory META-INF\services
iii)then create file META-INF\services\java.sql.Driver which contain single line
like.. com.mysql.jdbc.Driver
iv)update jar by ... jar -uf mysql-connector-java-5.0.6-bin.jar META-INF\services\java.sql.Driver


Add folowing code in module.xml of
..\jboss-as-web-7.0.0.Final\modules\com\mysql\jdbc\main


resources
resource-root path="mysql-connector-java-5.0.6.jar"/
/resources


if above stucture is not present then create it

start using Jboss as 7 .... really nice and light weight