I have a persistence/transaction/dbunit test and I'm trying to verify some database data so I have @Resource injected a DataSource from JNDI. The injection is successful and I can get a connection from it (debugger says closed=false) but when I try to do a simple connection.createStatement on it, I get an SQL exception with "connection closed". Is there anything special that needs to be done in the test? I've also tried @Inject with a producer that has the resource injected into a stateless EJB but same thing. Pointers?
Hmm, adding a @Transactional(value = TransactionMode.DISABLED) to the test helped. Apparently my service call did something to the transaction that made it impossible to open new connections to it and some exception was swallowed(?)