0

I am using postgresql, JBoss 7.1 and J2EE6. My project structure has 1 ear with 1 JAR holding EJBs and 1 WAR holding the web front.

I am delivering the postgresql driver as JBoss module and changing the standalone.xml to reference the data source. With the above everything works fine.

Now I want to use arquillian to test against a jboss managed instance with postgres data source. I don't want to change the jboss that is downloaded by maven because I want to deliver all my dependencies within my application (The only thing acceptable would be the data source configuration inside standalone.xml on JBoss).

The problem: If I start using postgresql jar inside EarContent/lib of the ear project I get missing/unsatisfied dependencies when starting jboss, looks like jboss can't locate the driver deployed inside standalone/deployments. Looking over the web ppl tell examples of how to use postgres driver with modules, but that is not what I want to do. I want to ship the postgresql driver along with the app so I have control over versions without much more effort (and I can test against postgres without adding the module to the jboss I will test against with arquillian).

How can I add the postgres driver to be shipped with my app without happening the missing/unsatisfied dependencies error in JBoss?

If this is not possible, how can I change JBoss files without manually changing every time I do a clean goal? Like modules and standalone.xml for example.

Fagner Brack
  • 2,365
  • 4
  • 33
  • 69
  • 1
    I think this is quite hard to achieve. See this comment, explaining why : http://stackoverflow.com/questions/3770741/should-jdbc-drivers-be-included-in-a-war#comment3991125_3770773 – Samuel EUSTACHI Feb 20 '13 at 09:17
  • You might be able to do something playing with the class loaders, but as this is also a change to the provided jboss, this is probably not acceptable for you either – Samuel EUSTACHI Feb 20 '13 at 09:18
  • Ok so how can I do that with arquillian without manually changing the jboss managed files? Is there any API? It can be considered as an answer also. – Fagner Brack Feb 20 '13 at 15:29
  • Don't know, found this : http://stackoverflow.com/a/6096078/709881 It might help – Samuel EUSTACHI Feb 20 '13 at 15:40
  • That is to add resources to jboss deployment and not manipulate jboss files itself – Fagner Brack Feb 20 '13 at 16:02
  • Leaving this as a comment, since I haven't tried this out and it might fail - you could define a `jboss-deployment-structure.xml` and deploy the postgresql driver as a JBoss module within your EAR. You may also need to define dependencies on this packaged module, via a `Dependencies` entry in other modules. More details are in the [JBoss AS7 wiki on class loading in AS7](https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7). – Vineet Reynolds Feb 21 '13 at 08:57

1 Answers1

0

It is impossible to ship the drivers within the application (Should JDBC drivers be included in a WAR?)

I found a way to solve the issue though:
Create a local repository in maven for org.jboss.as:jboss-as-dist:7.1.1.Final, the local repository will have a custom jboss distribution with the required drivers as modules (with a different artifactId/groupId if necessary).

When you test you will use your custom local repository instead of the oficial one, then you will have full control over which files you are going to require when testing with arquillian.

Community
  • 1
  • 1
Fagner Brack
  • 2,365
  • 4
  • 33
  • 69