Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3Unit BaseSessionBeanFixture test session bean in different jars

Anand das
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have problem with session bean injecting session bean in different jar.
One Session Bean injects another Session Bean which comes from a different JAR (different maven project). When running tests, reference doesn't get injected. It appears that only classes within same project (the content of build.outputDirectory) get loaded for annotation resolution

first session bean which is under test
@Stateless(name = "LService", mappedName = "ejb/LServiceJNDI")
1) public class LServiceBean implements LService {

2) @EJB(mappedName = "ejb/ALogDAOJNDI")
3) private ALogDAO aLogDAO;
4) public Long createLEntry(ALog entry) {
5) return aLogDAO.createEntry(entry);

my second bean which is getting injected ALogDAO is in different jar

when I run following test

public class LServiceUnitTest extends BaseSessionBeanFixture<LServiceBean> {

public void testMyBean(){
LServiceBean beanToTest = getBeanToTest();
final ALog log = new ALog();

}catch(Exception e){

I get Nullpointer exception. This is happening becos Line 3 in above code is null How to sort this out. I'm using maven... Can somebody direct me how to solve this.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic