0 Replies Latest reply on Aug 23, 2002 9:23 AM by Binoy Shah

    JndiView Fails with jboss 3.0.1

    Binoy Shah Newbie

      OLD EXTERNAL LDAP CONFIG for JBOSS Version 2.4.4

      --------------
      jboss.jcml
      --------------

      <!-- Bind a remote LDAP server -->

      external/ldap/practiceit
      sscldap.conf
      javax.naming.ldap.InitialLdapContext
      true


      OLD EXTERNAL LDAP CONFIG for JBOSS Version 2.4.4
      --------------
      sscldap.conf
      --------------
      java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
      java.naming.provider.url=ldap://192.9.200.5:389/dc=practiceit,dc=net
      java.naming.security.principal=cn=SystemManager,dc=practiceit,dc=net
      java.naming.security.authentication=simple
      java.naming.security.credentials=secretpass


      ****************************************************
      WORKING JAVA CODE FOR JNDI ACCESS for Version 2.4.4
      ****************************************************

      public String search(String name)
      {
      String bId ="";
      try
      {
      /* Create an environment for the initial directory context.*/
      /* Create the initial directory context. */
      DirContext drctx = new InitialDirContext(getInitialLdapContext().getEnvironment());;
      /* Set up and perform the search. Find all matching in ou=name. */
      String base = "o=PracticeVeterinary";
      String filter = "(ou="+name+")";
      SearchControls constraints = new SearchControls();
      constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
      NamingEnumeration results = drctx.search(base,filter,constraints);
      /* Print the search results. */
      if (!results.hasMore())
      {
      System.out.println("Nothing found.");
      }
      else
      {
      while (results.hasMore())
      {
      SearchResult sr = (SearchResult) results.next();
      Attributes attrs = sr.getAttributes();
      if (attrs == null)
      {
      System.out.println("No attributes");
      }
      else
      {
      /* For each attribute of the entry.
      find a custom entry called bid */
      Attribute bIdCtx = attrs.get("bid");
      bId = (String)bIdCtx.get(0);
      }
      }
      }
      }
      catch (NamingException e)
      {
      /* Handle any name/directory exceptions. */
      }//catch
      catch (Exception e)
      {
      /* Handle any other types of exceptions. */
      }//catch
      return bId;
      }
      public Context getInitialLdapContext() throws NamingException
      {
      String ldapCtxString = "external/ldap/practiceit";
      InitialContext initCtx = new InitialContext();
      Context ldapCtx = (Context)initCtx.lookup(ldapCtxString);
      return ldapCtx;
      }


      JBOSS 3.0.1 SETTINGS

      ------------------
      jboss-service.xml
      ------------------

      <!-- Added for creating external JNDI Reference to LDAP server -->

      external/ldap/practiceit
      /conf/sscldap.conf
      javax.naming.ldap.InitialLdapContext
      true


      ---------------------------------
      sscldap.conf file in conf folder
      ---------------------------------

      java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
      java.naming.provider.url=ldap://192.9.200.5:389/dc=practiceit,dc=net
      java.naming.security.principal=cn=SystemManager,dc=practiceit,dc=net
      java.naming.security.authentication=simple
      java.naming.security.credential=secretpass

      Once i add this reference and start the server the jndiView MBean doesnt work
      [B]
      If i invoke the list() function with (false) it just hangs and after around 20 minutes it
      gives out of memory error ( have put 512 M stack)[/B]

      2002-08-23 17:36:37,542 WARN [org.jboss.jbossweb] WARNING: Exception for /jmx-console/HtmlAdaptor
      RuntimeErrorException: Error in MBean operation 'list(,boolean)'
      Cause: java.lang.OutOfMemoryError
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:307)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:226)
      at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:195)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:171)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:77)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:59)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:344)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:313)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:554)
      at org.mortbay.jetty.servlet.WebApplicationHandler.handle(WebApplicationHandler.java:199)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1572)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1522)
      at org.mortbay.http.HttpServer.service(HttpServer.java:795)
      at org.jboss.jetty.Jetty.service(Jetty.java:531)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:784)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:941)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:799)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:186)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:322)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:713)
      at java.lang.Thread.run(Thread.java:479)
      getTargetError():
      java.lang.OutOfMemoryError
      <<no stack trace available>>


      [U]The list function works fine if i remove the externalContext configuration[/U]

      The java code too gives an exception "Not a DirContext" upon execution