0 Replies Latest reply on Sep 27, 2006 10:34 AM by Florian Bauer

    javax.naming.NameNotFoundException

    Florian Bauer Newbie

      I am new in the world of EJB3. I deployed an .ear file to jboss 4.0.4.GA usin Hibernate Entity Manager

      well, my SessionBean:

      @Stateless
      public class BaseSession implements BaseSessionRemote
      {
      
       @PersistenceContext(unitName="dooris-portal") private EntityManager entityManager;
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#find(com.dooris.util.beans.AbstractBasicBean)
       */
       public BasicBean find(final Class classGot, final Long lIDGot)
       {
       return (BasicBean) this.entityManager.find(classGot, lIDGot);
       }
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#merge(com.dooris.util.beans.AbstractBasicBean)
       */
       public BasicBean merge(BasicBean beanGot)
       {
       return (BasicBean) this.entityManager.merge(beanGot);
      
       }
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#persiste(com.dooris.util.beans.AbstractBasicBean)
       */
       public void persiste(BasicBean beanGot)
       {
       this.entityManager.persist(beanGot);
       }
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#findAll(java.lang.Class)
       */
       public Collection findAll(Class classGot)
       {
       return this.entityManager.createQuery("SELECT bean FROM " + classGot.getSimpleName()).getResultList();
       }
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#getEntityManager()
       */
       public EntityManager getEntityManager()
       {
       return this.entityManager;
       }
      
       /* (non-Javadoc)
       * @see com.dooris.util.hibernate.BaseSessionRemote#getLookupGroupByName()
       */
       public LookupGroup getLookupGroupByName(final String strNameGot)
       {
       return null;
       }
      
       }


      and the Remote interface:

      @Remote
      public interface BaseSessionRemote
      {
      
       public void persiste(final BasicBean beanGot);
       public BasicBean merge(final BasicBean beanGot);
       public BasicBean find(final Class classGot, final Long lIDGot);
       public Collection findAll(final Class classGot);
       public EntityManager getEntityManager();
       public LookupGroup getLookupGroupByName(final String strNameGot);
       public User findUserByEmailAndPassword(final String strEmailGot, final String strPasswordGot);
      }


      My persistence.xml:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
       version="1.0">
       <persistence-unit name="dooris-portal" transaction-type="JTA">
       <!-- java:/doorisPortalDB doorisPortalDB -->
       <jta-data-source>java:/doorisPortalDB</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       </properties>
       </persistence-unit>
      </persistence>


      And the Exception:

      15:26:55,007 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      15:26:55,217 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
      15:26:55,638 INFO [TomcatDeployer] deploy, ctxPath=/loom-portal, warUrl=.../deploy/loom-portal.war/
      15:26:55,878 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
      15:26:55,888 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
      15:26:57,941 INFO [STDOUT] [2006.09.27][com.dooris.util.hibernate.EJBUtil][BaseSession not bound][FATAL]:
      15:26:57,941 ERROR [STDERR] javax.naming.NameNotFoundException: BaseSession not bound
      15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      15:26:57,941 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      15:26:57,941 ERROR [STDERR] at com.dooris.util.hibernate.EJBUtil.createBaseSession(EJBUtil.java:34)


      what is wrong on my code or what is wrong with my jboss configuration?

      Thank you in advance!