0 Replies Latest reply on Aug 4, 2006 5:00 AM by renegade_xx

    javax.naming.NameNotFoundException: remote not bound

    renegade_xx

      Hi!

      I have a problem inconection with this error message.
      I'm new in ejb3, and i've desided that i try to make the RUBiS (http://rubis.objectweb.org) project with enterprise beans in ejb3.

      I have the following problem:

      If there is the @PersistenceContext(unitName="rubis") annotation in the BrowseRegionBean.java, I get the following error messeage:

      09:59:47,781 ERROR [STDERR] javax.naming.NameNotFoundException: remote not bound
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
      09:59:47,781 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
      09:59:47,781 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      09:59:47,781 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      09:59:47,781 ERROR [STDERR] at javax.naming.InitialContext.lookup(Unknown Source)
      09:59:47,781 ERROR [STDERR] at org.apache.jsp.browseRegion_jsp.jspInit(org.apache.jsp.browseRegion_jsp:26)
      09:59:47,781 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:78)
      09:59:47,781 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
      09:59:47,781 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
      09:59:47,781 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      09:59:47,781 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      09:59:47,781 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      09:59:47,781 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      09:59:47,781 ERROR [STDERR] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
      09:59:47,781 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
      09:59:47,781 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      09:59:47,781 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      09:59:47,781 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
      09:59:47,781 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      09:59:47,781 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      09:59:47,781 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      09:59:47,781 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
      


      if i put it to comment, the javax.naming.NameNotFoundException is disappear, but in this case I get the following msg:
      10:52:04,000 ERROR [STDERR] java.rmi.RemoteException: Failed to executeQuery java.lang.NullPointerException
      10:52:04,000 ERROR [STDERR] at edu.rice.rubis.beans.Session.BrowseRegionBean.getRegions(BrowseRegionBean.java:47)
      ...
      

      I know why I get the last message, bud I don't know how I can solve this problem

      Please help me,
      Thanks


      there are the codes:

      BrowseRegion.java
      @Remote
      public interface BrowseRegion {
       /**
       * Get all the regions from the database.
       *
       * @return a string that is the list of regions in html format
       * @since 1.1
       */
       public String getRegions() throws RemoteException;
       /**
       * Region related printed functions
       *
       * @param name the name of the region to display
       * @return a string in html format
       * @since 1.1
       */
       public String printRegion(String name) throws remoteException;
      


      BrowseRegionBean.java
      public @Stateless class BrowseRegionBean implements BrowseRegion {
       @PersistenceContext(unitName="rubis")
       private EntityManager em;
       /**
       * Get all the regions.
       *
       * @return a string that is the list of regions in html format
       * @since 1.1
       */
       public String getRegions() throws RemoteException
       {
       Collection <Region> rs = null;
       StringBuffer html = new StringBuffer();
       try
       {
       rs = em.createQuery("from Region r").getResultList();
       }
       catch (Exception e)
       {
       throw new RemoteException("Failed to executeQuery " +e);
       }
       try
       {
       for (Iterator iter = rs.iterator(); iter.hasNext();)
       {
       Region r = (Region) iter.next();
       html.append(printRegion(r.getName()));
       }
       }
       catch (Exception e)
       {
       throw new RemoteException("Failed to get the list of regions" +e);
       }
       return html.toString();
       }
      
       /**
       * Region related printed functions
       *
       * @param name the name of the region to display
       * @return a string in html format
       * @since 1.1
       */
      
       public String printRegion(String name) throws RemoteException
       {
       return "<a href=\""+BeanConfig.context+"/browseCategories.jsp?type=regio"+"®ion="+URLEncoder.encode(name)+"\">"+name+"</a><br>\n";
       }
      }
      


      browseRegion.jsp
       ...
       InitialContext ctx = new InitialContext();
       cal = (BrowseRegion) ctx.lookup(
       "RubisBeanEAR/BrowseRegionBean/remote");
       ...