I am creating a new EJB project with beans that are used in another simple project. I am using NetBeans 7.4 with Glassfish 4.0. Here are my Interface and implementation for the EJB project :
DbBeanInt.java
package com.ejb;
import javax.ejb.Remote;
@Remote
public interface DbBeanInt {
public void test(String asd);
}
DbBean.java
package com.ejb;
import javax.ejb.*;
@Stateless(name = "DbBean", mappedName="B")
@Remote
public class DbBean implements DbBeanInt{
@Override
public void test(String asd) {
System.out.println(asd);
}
}
And here is the code where I am calling it. I included in this project's library the EJB project.
package bookstoreclient;
import com.ejb.DbBeanInt;
import javax.ejb.EJB;
public class BookStoreClient {
@EJB
private static DbBeanInt db;
public static void main(String[] args) {
db.test("Test");
}
}
However when I run this application I get :
Exception in thread "main" java.lang.NullPointerException
at bookstoreclient.BookStoreClient.main(BookStoreClient.java:12)
Is there something else that should be included?