Trying to create the simplest EJB using NetBeans 7.0 and EJB 3 in Action book.
Well, firstly I’ve created an interface:
package study;
public interface NewInterface {
public void sayHello(String name);
}
Then, the EJB:
package study;
import javax.ejb.Stateless;
public class NewClass implements NewInterface{
@Override
@Stateless //! ERROR here !
public void sayHello(String name) {
System.out.println("Hello " + name);
}
}
Java complains at @Stateless
annotation type is not applicable to this kind of declaration
Why?
Should be on the class declaration (not the method). Like so :
From here