I've also posted this on jboss-user and haven't received any reply yet...
I'm running JBoss 3.2.1 with the 1.4.2 Sun JDK on a Mandrake Linux 9.1 box, I have two apps packaged in separate ears and I use ear scoping because I have classes that are common to the two apps and I don't want any duplicate class problems... On the other hand, I have some test classes also included in the ear which use JUnitEJB for running in the server JVM. I've deployed the junitejb and junit jars separately from the ears and now, when running the tests, it seems the EJBTestRunner session bean can't find the test classes, which is, well, probably rather obvious if I understand ear scoping well (the test class gets loaded in a different repository, and the class loader that EJBTestRunner uses can't find it in the global class repository).
Packaging the junitejb.jar in the ears solves the problem temporarily, but the trouble is, what if I want to deploy both ears at the same time? It's a common scenario I have to take care of, and putting junitejb in both ears would cause a JNDI name clash as far as I understand.
My question is: How can I achieve both things - being able to deploy both apps, which is important, and use ear scoping? How should I package my classes? Is there a solution or do I have to give up on one of the two goals above?
There is a known issue with JUnitEJB and classloaders.
JBoss has an implementation in the blocks module if
you download the source.