[jboss-user] [EJB3] - EJB is null Please Help

Manolescu Sebastian do-not-reply at jboss.com
Fri Apr 6 07:25:38 EDT 2012


Manolescu Sebastian [https://community.jboss.org/people/mano_seba] created the discussion

"EJB is null Please Help"

To view the discussion, visit: https://community.jboss.org/message/728650#728650

--------------------------------------------------------------
Hello,

I try to use TestNG but the @EJB is null, but it's not a detailed error :(( . I use arquillian but I doubt that this is the problem in this case, I've made other tests just like this whit different services but the EJ is not null, only 4 out 0f 10 services are null. :0 


In the surfire reports it shows:

SubscriptionSaveTest(com.project.scr.prj.service.SubscriptionServiceTest)  Time elapsed: 0.015 sec  <<< FAILURE!
java.lang.NullPointerException
    at com.project.scr.prj.service.SubscriptionServiceTest.SubscriptionSaveTest(SubscriptionServiceTest.java:98)




The test looks like

public class SubscriptionServiceTest {

    private final String TEST_VALUE = "test";
    private final Date TEST_DATE = new Date();
    private final Long TEST_LONG = 3l;

     @Deployment
       public static WebArchive createTestArchive() {
         return      ShrinkWrap.create( WebArchive.class,"test.war").addPackages(true,"org.joda.time").addPackages(true, "javax.jcr").addClasses(com.mysql.jdbc.log.Log.class,com.project.scr.prj.model.Subscription.class).addPackage("org.slf4j").addPackage("org.slf4j.spi").addPackage("org.slf4j.helpers").addAsWebInfResource("test-persistence.xml", "classes/META-INF/persistence.xml").addAsWebInfResource("beans.xml", "META-INF/beans.xml");
     }

     @EJB(name ="subscriptionService")
     private SubscriptionService subscriptionService;



     @BeforeTest
     @UsingScript("import.sql")
     public void setUp()
     {}


     public Subscription FillSubscription(){

     System.out.println("TEST"+subscriptionService); // in the console shows null
}


     Sorry for my bad english :) 


Best Regards
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/728650#728650]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120406/4cece7dd/attachment.html 


More information about the jboss-user mailing list