On Mon, Nov 22, 2010 at 3:54 PM, Tony Tubbs <[email protected]> wrote: > I set properties for Derby in my setUpClass method as explained in the > "Configuring DataSources in Tests" documentation. When I run the tests, the > only thing I can see about my datasource in the output is a line similar to > what > I've pated in below. I do get notice that my EJB's loaded and can to a lookup > on the EJBs but not the DataSource. I'd try to do the lookup like so: > initialContext.lookup("MYDB"). > > I am not using JPA, so do not have a persistence.xml file. As I am embedding > things directly into the JUnit test class(es), it is my understanding I > shouldn't need any any other xml files either - like the openejb.xml or > jndi.properties, etc. Will I require a persistence.xml file just for my JUnit > tests? Hoping it's something easy you can point me to. > > - Configuring Service(id=MYDB, type=Resource, provider-id=Default JDBC > Database)
If you want to use a non-portable name, your bean can lookup "openejb:Resource/MYDB". If you want to do things the portable way, your bean has to declare a reference to the resource via xml or annotation: http://openejb.apache.org/3.0/resource-ref-for-datasource.html This doc is still a work in progress, but has some info on Java EE and JNDI: http://openejb.apache.org/3.0/basics-getting-things.html -David
