In the previous version
of JBoss, the configuration of Datasource was quit easy: the datasource file is
defined in the JBoss_Home/server/default/deploy/*-ds.xml, while the JDBC driver
is just placed in the JBoss_Home/server/default/lib directory.
In the JBoss EAP 6 is
quit different and this is done as below.
In the
Jbosseap6/modules, create the directory hierarchy : org/postgresql/main. Put in
the main directory the database jdbc.
In the same directory,
create a file named module.xml and put the following code. Make sure to change
the JDBC version according to the used one.
I prefer to manually configure the driver by making changes in the standalone.xml located in "C:\jboss-eap-6.1\standalone\configuration" I add Datasource in the Datasources balise and Driver in Drivers.
In my code I have :
private static final String POSTGRES_DS = "java:jboss/datasources/myPostgresDS";
I run after my server and it's OK !
@Mariem Jabloun Thank you so much for posting this.
ReplyDeleteThis solves my problem of creating DataSource in Jboss EAP 6.1. I'll bookmark this for future reference.
Keep sharing your knowledge with us.
Good :)
Delete