It would have been helpful to add some piece of code in your question, at least the annotations in your EJB, local interface (if you annotated it) and servlet...
Nevertheless, according to the Chapter 11. Introduction to EJB injection in Servlets of the JBoss EJB3 Tutorials, for an EJB module containing an EJB3 SLSB defined like this:
@Stateless(name="calculator")
@Remote(CalculatorRemote.class)
@Local(CalculatorLocal.class)
public class CalculatorBean implements CalculatorRemote, CalculatorLocal
{
...
The local interface can be injected in a Servlet of a web module this way:
private CalculatorLocal calculator;
/**
* Injecting the EJB
*/
@EJB(name = "calculator")
public void setCalculator(CalculatorLocal calculator)
{
this.calculator = calculator;
}
There is an important note in this tutorial that i'm pasting below:
For the injection to take place in a
web module, your web.xml should use
the 2.5 version of the web-app xsd:
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">