File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes OpenEJB + JUnit + Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "OpenEJB + JUnit + Ant " Watch "OpenEJB + JUnit + Ant " New topic

OpenEJB + JUnit + Ant

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 116
I have recently begun to write JUnit Tests for EJBs using OpenEJB.
From within Eclipse it works like a charm.

However cannot make it work from my Ant Script.
In the examples supplied with OpenEJB it stated that:
"As long as OpenEJB and it's required libraries are in the
<junit> classpath, the tests will run with OpenEJB embedded."

I don't think my tests run with OpenEJB embedded, because the tests fail for every class which uses dependency injection:

My ant script:

The classpath used for running the Junit test is (from the echo in target "test")

Clearly the OpenEJB jars are in the classpath.

Any ideas what I am doing wrong?

Many thanks,

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 116
I found out for myself:

You have to copy the META-INF directory with ejb-jar.xml into the build directory of your project classes.
I agree. Here's the link:
subject: OpenEJB + JUnit + Ant
jQuery in Action, 3rd edition