-
1. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
maeste Jun 30, 2014 10:44 AM (in response to javapapo)Could you please attach your test-ds.xml?
And could you provide which version of postgres are you using?
regards
S.
-
2. Re: Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
javapapo Jun 30, 2014 12:03 PM (in response to maeste)Hello Stefano, so here is my case:
The Datasource definition as is in the web.xml is working fine,I am listing it below just to have something to compare.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <data-source> <name>java:jboss/datasources/testpostgre</name> <class-name>org.postgresql.xa.PGXADataSource</class-name> <server-name>localhost</server-name> <database-name>papodb</database-name> <user>papo</user> <password>papo</password> <transactional>true</transactional> </data-source> </web-app>
The postgresql driver I am actually loading from my pom (see above)
postgresql:postgresql9.1-901-1.jdbc4
My ds.xml file is the following- I think the drivers tag is not valid, if this is true, then according to the note in the documentation you can not deploy a datasource on the fly referencing a driver at same time? By the way some examples or notes on the 1_1 xsd would help (in the documentation).
<datasources xmlns="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_1.xsd"> <datasource jndi-name="java:jboss/datasources/testpostgre" pool-name="testpostgre" enabled="true" use-java-context="true"> <connection-url>jdbc:postgresql://localhost:5432/papodb</connection-url> <driver>postgresql</driver> <security> <user-name>papo</user-name> <password>papo</password> </security> <driver-class>org.postgresql.xa.PGXADataSource</driver-class> <!-- the drivers tag is not valid with this XSD--> <drivers> <driver> <driver name="postgresql" module="org.postgresql"> <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> </driver> </driver> </drivers> </datasource> </datasources>
Many thanks!
-
3. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
ctomc Jun 30, 2014 7:18 PM (in response to javapapo)Any reason why you don't use http://docs.oracle.com/javaee/7/api/javax/annotation/sql/DataSourceDefinition.html ?
as this is the portable way of using defining deployable data sources which are most useful for testing.
-
4. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
javapapo Jul 1, 2014 12:59 PM (in response to ctomc)My case was unit tests using arquillian. I wanted to decouple the DS definition from code or annotations and leverage (if it works) the ability to package one extra file, which can me altered using maven properties prior to deployment.
-
5. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
ctomc Jul 1, 2014 2:48 PM (in response to javapapo)1 of 1 people found this helpfulClass that has @DatasourceDefinition can be part of test case only, you just add it as extra class to when you are creating deployment.
There is no need for your application code to have this annotation as well.
-
6. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
bmajsak Jul 11, 2014 7:13 AM (in response to ctomc)So what's the outcome javaneze ? Can you share your solution and we can close this thread?
-
7. Re: Deployable Datasource + driver deployment in one go? Wildfly 8.1 / Arquillian
javapapo Jul 11, 2014 7:55 AM (in response to bmajsak)Hi, I think there is no outcome, it seems that Wildfly 8.1 does not support my case as, indicated in my original post. You can use workarounds (like I did, defining the DS in an JavaEE descriptio (ear or war level).