users@glassfish.java.net

Injecting EJB to Servlet - ClassNotFoundException

From: <forums_at_java.net>
Date: Fri, 28 Dec 2012 10:30:35 -0600 (CST)

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.

--
[Message sent by forum member 'naveensisupalan']
View Post: http://forums.java.net/node/893496