I apologize for mistake in my previous article. I have forgotten to remove PostgreSQL JDBC-driver from dependencies list, so it has covered a mistake of defining of JDBC-driver as jBoss module.
Here are amendments to the previous article:
- Be sure that dependency
<dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.4-1200-jdbc41</version> <scope>all</scope> </dependency>
is removed from pom.xml file of your simplecrud-service-spring project
- Place module.xml and JAR-files into $JBOSS_HOME/modules/org/postgresql/main directory instead of
- If you run jBoss in standalone mode, open $JBOSS_HOME/standalone/configuration/standalone.xml file and append manually new JDBC-driver reference in section “subsystem/datasources/drivers”:
<driver name="PostgreSQL" module="org.postgresql"> <xa-datasource-class>org.postgresql.Driver</xa-datasource-class> </driver>
After jBoss restart it will appear in list of available JDBC-drivers. jBoss can’t detect some JDBC-drivers in it’s modules authomatically because of some supposed bug, which can’t recognizes JDBC-driver, if module contains more than one it’s implementation.
- Restart jBoss, open a console, and create new data source using “PostgreSQL” JDBC-driver, which appears in list of available drivers.