5 Replies Latest reply on May 9, 2003 8:49 PM by Jon Barnett

    ejb 'not bound'

    sys user Master

      I have an EJB 'BookingManager' that shows up as being bound to a jndi name in the jboss console

      jndiName=ejb/BookingManager,service=EJB

      EJBModule=conductor.jar,J2EEApplication=conductor.ear,J2EEServer=Single,j2eeType=StatelessSessionBean,name=ejb/BookingManager

      but consistently deploys as being 'not bound' as shown below. It connects to a Postgres database which I can confirm from the Postgres log; it's actually more like it briefly 'hits' the db then seems to dissapear...
      ?????

      11:36:51,078 ERROR [GenericView] javax.naming.NameNotFoundException: BookingManager not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at edu.stanford.scil.conductor.web.servlet.Controller.initializeResourceCache(Controller.java:375)
      at edu.stanford.scil.conductor.web.servlet.Controller.init(Controller.java:99)
      at edu.stanford.scil.conductor.web.servlet.GenericView.init(GenericView.java:34)
      at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:225)
      at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:444)
      at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:163)
      at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:492)
      at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:414)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243)

        • 1. Re: ejb 'not bound'
          Adrian Brock Master

          Post the lookup code.

          Regards,
          Adrian

          • 2. Re: ejb 'not bound'
            sys user Master

            Lookup code below - you can see all of the other lookups I've tried commented out - the current one is the only one that doesn't generate an error & seems to connect
            THANKS much

            package edu.stanford.scil.conductor.ejb.util;
            import org.apache.log4j.*;
            import javax.naming.*;
            import java.rmi.*;
            import java.sql.*;
            import javax.sql.*;

            public class Util
            {
            private static Category logger = Category.getInstance(Util.class.getName());

            private static final String dataSourceName = "java:/PostgresDS";
            // private static final String dataSourceName = "jdbc/PostgresDS";
            // private static final String dataSourceName = "java:/jdbc/PostgresDS";
            // private static final String dataSourceName = "java:comp/env/jdbc/PostgresDS";

            /** returns a JDBC Connection the the database used by the Conductor app */
            public static Connection getConnection()
            throws SQLException, RemoteException
            {
            logger.info("get datasource");
            DataSource ds = getDataSource(dataSourceName);
            return ds.getConnection();
            }

            private static DataSource getDataSource(String dsName)
            throws RemoteException
            {
            DataSource ds = null;
            try
            {
            Context ic = new InitialContext();
            ds = (DataSource) ic.lookup(dsName);
            } catch (NamingException e)
            {
            logger.error(e.toString());
            throw new RemoteException(e.getMessage());
            }
            return ds;
            }
            }

            • 3. Re: ejb 'not bound'
              Jon Barnett Master

              The problem seems to be manifesting on the servlet side of things so I think Adrian was asking about the servlet look-up. In particular, what is the look-up code for finding BookingManager? Your servlet can't seem to find the reference you provide in the JNDI repository.

              • 4. Re: ejb 'not bound'
                sys user Master

                Pardon my ignorance but I hope that the below is what you are referring to - I inherited this project from someone else & am not too savvy in this domain (if that wasn't obvious...)
                The app was originally deployed to Oracle App Server so I changed these 2 lines below:
                THANKS!

                env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );

                // env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");

                env.put(Context.SECURITY_PRINCIPAL, "admin");
                env.put(Context.SECURITY_CREDENTIALS, "welcome");

                // env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
                env.put(Context.PROVIDER_URL, "ormi://localhost/conductor");

                Context ctx = new InitialContext(env);
                BookingManagerHome bookingManagerHome = (BookingManagerHome)ctx.lookup("BookingManager");
                BookingManager bookingManager;
                bookingManager = bookingManagerHome.create();
                Date rangeStart = dFormat.parse("2002.08.20 12:00:00");
                Date rangeEnd = dFormat.parse("2002.09.20 16:00:00");
                RoomHome roomHome = (RoomHome)ctx.lookup("Room");
                Room room = roomHome.findByName("Classroom 120");

                • 5. Re: ejb 'not bound'
                  Jon Barnett Master

                  Your JNDI binding for BookingManager is ejb/BookingManager. But you are looking for "BookingManager". Have you tried searching the JNDI space for "ejb/BookingManager"? Or "java:/ejb/BookingManager"?