1 Reply Latest reply on Feb 25, 2008 9:44 AM by jaikiran pai

    JNDI - javax.ejb.EJBException

    MARCOS GOMES Newbie

      Hi,

      I have a problem finding out a session bean:

      javax.servlet.ServletException: javax.ejb.EJBException: javax.naming.NameNotFoundException: travel not bound
      org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:126)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      --------------------------------------------------------
      I'm trying to access the bean like this:

      TravelAgentLocal travelag = null;
      try {
      javax.naming.InitialContext ctx = new InitialContext( );
      travelag = (TravelAgentLocal)ctx.lookup("travel");
      }
      catch (javax.naming.NamingException ne) {
      throw new EJBException(ne);
      }

      --------------------------------------------------------
      This is my session bean:

      package com.travelagent;

      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;

      import org.jboss.seam.annotations.Name;

      import com.entitybean.Empresa;

      @Stateless
      @Name("travel")
      public class TravelAgentBean implements TravelAgentRemote, TravelAgentLocal{
      @PersistenceContext(unitName="system") private EntityManager manager;

      public void createEmpresa(Empresa emp){
      manager.persist(emp);
      }

      public Empresa findEmpresa(int pKey){
      return manager.find(Empresa.class, pKey);
      }
      }

      The question is: using this session bean inside a war file it doesn't work, but when I deploy it using a jar file, deleting "@Name("travel")" it works well.

      Could someone help me, please ?

      Thanks