I am trying to deploy my spring-boot application to WildFly Version 8.1, but I get an javax.naming.NameNotFoundException, everytime the app tries to boot.
My Configuration:
I added the JDBC as Module to the WildFly-Standalone instance.
module.xml:
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.4-1201.jdbc41.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
After that I defined the driver:
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
</driver>
Then added a datasource to the standalone.xml
<datasource jndi-name="java:jboss/jdbc/MyDS" pool-name="MyDS" enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/databasename</connection-url>
<driver>postgresql</driver>
<security>
<user-name>username</user-name>
</security>
</datasource>
Testing the connection via JBoss-CLI results in a success.
So Now when I try to load the DataSource via:
@Bean
public DataSource getDataSource() {
JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
DataSource dataSource = dataSourceLookup.getDataSource(this.jndiName);
return dataSource;
}
When I deploy via jboss-cli:
deploy /path/to/myapplication.war
I get:
Caused by: javax.naming.NameNotFoundException; remaining name 'java:jboss/jdbc/MyDS'"}}}}
Versions:
- spring-boot 1.2.2.RELEASE
- wildfly-8.2.0Final
Thanks for your help :)
Aucun commentaire:
Enregistrer un commentaire