0 Replies Latest reply on Jan 12, 2018 12:15 PM by Ray Ramos

    Using @EJB Causes JUnit to Fail, but tests still run and succeed on server side

    Ray Ramos Newbie

      I'm using the latest Arquillian universe version and Wildfly remote container 2.1.0 final.


      I have a test that injects a POJO using @Inject.  When I run the test, the test passes, green bar in JUnit.  From logging statements on the Wildfly server side, I can see the code is being executed.  So far so good.  Next, I introduce an @Stateless EJB using @EJB and write a new @Test.


      Here comes the weird part.  Just the act of adding an EJB with @EJB breaks JUnit on the client.  I removed my second test method and left just the injected @EJB field.  My logging statements on the server side verify that nothing is null and works.  However, back in the Arquillian/JUnit client, the test explodes with a NPE.  It is as if JUnit core ends up running the @Test method also, after Arquillian returns from the server.  The dependencies are not injected by JUnit, and are null.


      To be clear, @Inject and @EJB iare working in Wildfly and the code is running and working there.  After the test runs in Wildfly, the test later breaks in the client.  Googling around I can't find a hint.  Please advise and thanks in advance.


      Message was edited by: Ray Ramos Found the problem.  Project was configured to use "arquillian-junit-standalone" instead of "arquillian-junit".  I'm not sure why the introduction of @EJB started the breakage, but using the container aware "arquillian-junit" and resolved the issue.