2 Replies Latest reply on Mar 15, 2006 10:14 AM by krypton

    please help me in this issue

    sobhi Abd Al Maseah Newbie

      Caught an exception.
      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at samples.ejb.bmp.simple.client.StorageBinClient.main(StorageBinClient.java:20)


      how can i solve it here is the code:

      Context initial = new InitialContext();
      Object objref = initial.lookup("java:comp/env/ejb/SimpleStorageBin");

      StorageBinHome storageBinHome =
      (StorageBinHome)PortableRemoteObject.narrow(objref,
      StorageBinHome.class);

      objref = initial.lookup("java:comp/env/ejb/SimpleWidget");

      WidgetHome widgetHome =
      (WidgetHome)PortableRemoteObject.narrow(objref,
      WidgetHome.class);

      String widgetId = "777";
      StorageBin storageBin = storageBinHome.findByWidgetId(widgetId);
      String storageBinId = (String)storageBin.getPrimaryKey();
      int quantity = storageBin.getQuantity();

      Widget widget = widgetHome.findByPrimaryKey(widgetId);
      double price = widget.getPrice();
      String description = widget.getDescription();

      System.out.println(widgetId + " " +
      storageBinId + " " +
      quantity + " " +
      price + " " +
      description);

      System.exit(0);