0 Replies Latest reply on Oct 9, 2002 2:34 PM by scmikes

    client JNDI  config problem

    scmikes

      Hello,

      I am starting to use JBOSS as a host for
      GRID computing. I have a workflow that I need to
      execute across several machines. I would like to
      use JNDI to store run info during the workflow execution.

      I was looking the the "for pay docs" in the JNDI section for Jboss3.0.3 (good docs, worth the $$). It had good coverage of JNDI setup. But it did not cover JNDI context cleanup.

      Specificially, I want to create a scratch subcontext
      for a run, then delete the subcontext at the end of the
      run.

      In a nutshell here is what I am doing in the example client code (code at end of post):
      - Obtain root context (works)
      - create "plm" subcontext (works)
      - create the binding in "plm" subcontext (works)
      (foo, bar)
      (run, it)
      (really, good)
      - list contents of "plm" subcontext (works)
      - drop the subContext (fails with operation not supported error)



      Do I have to set some security parameters somewhere in the JBOSS JNDI config to allow clients to delete
      a subContext??


      Thanks,
      Mike


      Here is the info:

      --------------- Client Error ---------------------
      D:\scmikes\jndi\work1>ant run.client_1

      [java] javax.naming.OperationNotSupportedException
      [java] at org.jnp.interfaces.NamingContext.destroySubcontext(NamingContext.java:828)
      [java] at javax.naming.InitialContext.destroySubcontext(InitialContext.java:403)
      [java] at Client_1.main(Client_1.java:19)
      [java] Foo: java.lang.String
      [java] really: java.lang.String
      [java] run: java.lang.String




      ------------ jndi.properties -------------------
      java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
      java.naming.provider.url=http://localhost:8080/invoker/JMXInvokerServlet
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      ------------- Client Source Code -------------------

      import javax.naming.InitialContext;
      import javax.naming.Context;
      import javax.naming.NamingException;
      import javax.naming.NamingEnumeration;
      import javax.naming.NameClassPair;

      import javax.naming.directory.*;

      public class Client_1
      {
      public static void main(String [] args)
      {

      try {

      Context ctx = new InitialContext();


      //--------------- Create new sub context ----------
      Context newCtx = ctx.createSubcontext("plm");

      //---------------- Create Mappings in plm
      newCtx.bind("Foo", "Bar");
      newCtx.bind("run", "it");
      newCtx.bind("really", "good");


      //--------- start over, listing context
      NamingEnumeration list = ctx.list("plm");

      while (list.hasMore()) {
      NameClassPair nc = (NameClassPair)list.next();
      System.out.println(nc);
      }


      //-------------------------- Delete new context
      ctx.destroySubcontext("plm");

      }
      catch (javax.naming.NamingException ne)
      {ne.printStackTrace();}
      }

      }

      ------------- Build.xml (from JBOSS workbook ) ----------
      <?xml version="1.0"?>









      <!-- Build classpath -->





      <!-- So that we can get jndi.properties for InitialContext -->





      <!-- =================================================================== -->
      <!-- Prepares the build directory -->
      <!-- =================================================================== -->





      <!-- =================================================================== -->
      <!-- Compiles the source code -->
      <!-- =================================================================== -->














      <!-- =================================================================== -->
      <!-- Cleans up generated stuff -->
      <!-- =================================================================== -->