daudiam -6 Junior Poster
@Local
public interface EJBA{
// declares a method 'validate'
}

@Stateless
public class EJBABean implements EJBA{
// implements the method 'validate'
}

class Model{
@EJB
private EJBA ejbA;
public void doSomething(){
   ejbA.validate();
}
}

Now, if I do the following from the execute method of a Struts 1.2 action class

new Model().validate();

ejbA of Model is null, resulting in a NullPointerException. I am running the client code (Model) as well as the bean in the JBoss 6.1 Final server itself. The model and the EJB are in the a separate jar file and the the action classes are in a war file. Both of these are packaged inside an ear file.

If I use a context lookup using [ear-name]/EJBABean/local, I am able to access it though. What am I doing wrong ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.