I am getting classnotfound exception for all EJBs when trying to inject EJBs to a servlet.
Both EJBs and servlet are in same EAR file.
org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.naveen.samples.jeesample1.servlets.TestServlet.
My EJB:
@Stateless
public class TestService implements TestServiceLocal {
@Override
public String greet(final String name) {
return "Hello " + name;
}
}
EJB Local Interface:
@Local
public interface TestServiceLocal {
String greet(final String name);
}
Servlet:
@WebServlet(name = "TestServlet", urlPatterns = {"/test"})
public class TestServlet extends HttpServlet {
@EJB
private TestServiceLocal local;
}
I haven't changed any configuration files or anything. Is there anything I am missing. I can deploy the same ear file to JBOSS and it works fine.