3 Replies Latest reply on Jul 1, 2002 2:42 PM by Eric Cire

    can't find SerialContextProvider

    Silver Blea Newbie

      hello,

      I am trying to use jboss3.0.0 on windows 2000. (jdk 1.3) I have implemented the EJBHomeFactory class. However, when I try a InitialContext() with no arguments I am get the following exception when my client app attempts to perform a JNDI lookup of a session bean:


      [EJBHomeFactory] Got initial context = localhost:1099@java:comp/env
      javax.naming.CommunicationException: Can't find SerialContextProvider
      at com.sun.enterprise.naming.SerialContext.getProvider(../../src/share/com/sun/enterprise/naming/SerialContext.java:65)
      at com.sun.enterprise.naming.SerialContext.lookup(../../src/share/com/sun/enterprise/naming/SerialContext.java:134)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at org.jschedule.util.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:127)
      at org.jschedule.test.TestSessionBeans.main(TestSessionBeans.java:31)
      Can't find SerialContextProvider
      org.jschedule.util.EJBHomeFactoryException: Can't find SerialContextProvider
      at org.jschedule.util.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:145)
      at org.jschedule.test.TestSessionBeans.main(TestSessionBeans.java:31)

      I placed the jndi.properties files in the same directory
      as org.jschedule.test.TestSessionBeans. If I set
      the properties values in EJBHomeFactory, everthing works fine. where is the proper place for a jndi.properties file? a seperate directory? I am using forte4j to run
      my client app. thanks.

      Silver

      for some reason i can't attached files on the forum.
      code is below

      public class EJBHomeFactory {

      private Map m_ejbHomes; // map of all ejb home interfaces
      private Context m_jndiCntx;
      private static String m_hostProviderURL;
      private static EJBHomeFactory aFactorySingleton;

      // ********************************************************************
      // Private constructor to allow only a single instance. Initializiation
      // of the Context with System property Info should take place here.
      // ********************************************************************
      private EJBHomeFactory() throws NamingException {

      // Set up the naming provider; this may not always be necessary, depending
      // on how your Java system is configured.
      // ... Specify the JNDI properties specific to the vendor.
      try {
      Properties env = new Properties();
      env.setProperty("java.naming.factory.initial", JNDINames.JAVA_NAMING_FACTORY);
      env.setProperty("java.naming.factory.url.pkgs", JNDINames.JAVA_NAMING_FACTORY_URL);
      env.setProperty("java.naming.provider.url", m_hostProviderURL);
      env.setProperty("jnp.socketFactory", JNDINames.JAVA_JNP_FACTORY);
      env.setProperty("jnp.timeout", "0");
      env.setProperty("jnp.sotimeout", "0");
      m_jndiCntx = new javax.naming.InitialContext();
      System.out.println("[EJBHomeFactory] Got initial context = " +
      m_hostProviderURL + "@java:comp/env");
      // prevent an accidental unsynchronized access to the map
      m_ejbHomes = Collections.synchronizedMap(new HashMap());
      }
      catch (Exception e) {
      // Can't do anything about this. Client will
      // catch errors upon trying to do a lookup.
      }


      // ********************************************************************
      // ********************************************************************
      public EJBHome lookUpHome(Class homeClass) throws EJBHomeFactoryException {

      // find the specific class name
      javax.ejb.EJBHome anEJBHome = (javax.ejb.EJBHome) m_ejbHomes.get(homeClass);
      try {
      if (anEJBHome == null) {
      // Obtain an abstract reference to the EJB's home interface
      Object objref = m_jndiCntx.lookup("ejb/" + homeClass.getName());
      System.out.println("[EJBHomeFactory].lookUpHome() Got reference = ejb/" + homeClass.getName());
      // Convert the abstract reference to the home interface
      anEJBHome = (javax.ejb.EJBHome) javax.rmi.PortableRemoteObject.narrow(objref, homeClass);
      System.out.println("[EJBHomeFactory].lookUpHome() Got home interface");
      // Insert the ejbhome into the hash map for fast lookups next time
      m_ejbHomes.put(homeClass, anEJBHome);
      }
      }
      catch (ClassCastException e) {
      throw new EJBHomeFactoryException(e);
      }
      catch (ClassNotFoundException nfe) {
      nfe.printStackTrace();
      throw new EJBHomeFactoryException(nfe);
      }
      catch (NamingException ne){
      ne.printStackTrace();
      throw new EJBHomeFactoryException(ne);
      }
      return anEJBHome;
      }
      }

        • 2. Re: can't find SerialContextProvider
          Silver Blea Newbie

          ok, removed the reference of j2ee.jar and instead
          using jboss-j2ee.jar. Now I am getting the following
          CommunicationException:

          [EJBHomeFactory] Got initial context = localhost:1099@java:comp/env
          javax.naming.CommunicationException: Receive timed out. Root exception is java.io.InterruptedIOException: Receive timed out
          at java.net.PlainDatagramSocketImpl.receive(Native Method)
          at java.net.DatagramSocket.receive(DatagramSocket.java:392)
          at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:919)
          at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1009)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:436)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
          at javax.naming.InitialContext.lookup(InitialContext.java:350)
          at org.jschedule.util.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:127)
          at org.jschedule.test.TestSessionBeans.main(TestSessionBeans.java:31)
          org.jschedule.util.EJBHomeFactoryException: Receive timed out
          at org.jschedule.util.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:145)
          at org.jschedule.test.TestSessionBeans.main(TestSessionBeans.java:31)
          Receive timed out


          any clues or links to a forum topic?
          thanks

          silver

          • 3. Re: can't find SerialContextProvider
            Eric Cire Newbie

            I'm getting the same exception, trying to run a standalone client in JBoss 3.0.0