8 Replies Latest reply on Sep 20, 2012 10:13 AM by Arthur Gerson

    @EJB(lookup="xx") fails.

    Arthur Gerson Newbie

      Sorry ahead of time if this problem is clarified else where.

      Using Eclipse I have created a bean called Foo and a servlet to call it.


      package com.foo.ejb;

      import javax.ejb.LocalBean;

      import javax.ejb.Stateless;


      * Session Bean implementation class Test




      public class Foo implements FooRemote, FooLocal {


           * Default constructor.


          public Foo() {

              // TODO Auto-generated constructor stub


      }//End of file Foo.java


      package com.foo.ejb;

      import javax.ejb.Local;


      public interface FooLocal {

      }//End of file FooLocal.java



      package com.foo.ejb;

      import javax.ejb.Remote;


      public interface FooRemote {

      }//End of file FooRemote.java




      import java.io.IOException;

      import javax.ejb.EJB;

      import javax.servlet.ServletException;

      import javax.servlet.annotation.WebServlet;

      import javax.servlet.http.HttpServlet;

      import javax.servlet.http.HttpServletRequest;

      import javax.servlet.http.HttpServletResponse;

      import org.jboss.logging.Logger;

      import com.foo.ejb.FooRemote;


      * Servlet implementation class TheServlet



      public class TheServlet extends HttpServlet {

                private static final long serialVersionUID = 1L;

                private Logger logger = Logger.getLogger(TheServlet.class);


        @EJB( lookup="java:global/FooBean/Foo!com.foo.ejb.FooRemote")

                                        private FooRemote foo ;



           * @see HttpServlet#HttpServlet()


          public TheServlet() {


              // TODO Auto-generated constructor stub





                 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)


                protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                          logger.info("PlaceBidServlet says hi!");





                 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)


                protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                          // TODO Auto-generated method stub


      }//End of file TheServlet.java


      I used the JBoss log to get the global JINI string and placed into the servlet.












      I am getting the following.

      Caused by: java.lang.NoClassDefFoundError: Lcom/foo/ejb/FooRemote;

      Caused by: java.lang.ClassNotFoundException: com.foo.ejb.FooRemote


      This is JBoss version

      JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

      So I am assuming this type of injection is supported. The test works fine when the client and ejb are in the same project/war but I want to separate them.  Does anybody see what I am doing wrong? Any help would be greatly appreciated.


      Thanks, Art