Bugs item #601193, was opened at 2002-08-28 10:09
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=601193&group_id=22866

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Binoy Shah (swatkat)
Assigned to: Nobody/Anonymous (nobody)
Summary: jndiView.list Fails with ExternalContext

Initial Comment:
JBoss Version : Build 3.0.1

OS : Windows 2000 Server

Java version : 1.3.1_03 
Java(TM) 2 Runtime Environment, Standard Edition 
(build 1.3.1_03-b03)
Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed 
mode)

OLD EXTERNAL LDAP CONFIG for JBOSS Version 
2.4.4

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

<!-- Bind a remote LDAP server -->
<mbean code="org.jboss.naming.ExternalContext" 
name="DefaultDomain:service=ExternalContext,jndiNam
e=external/ldap/practiceit" >
    <attribute 
name="JndiName">external/ldap/practiceit</attribute>
    <attribute 
name="Properties">sscldap.conf</attribute>
    <attribute 
name="InitialContext">javax.naming.ldap.InitialLdapCont
ext</attribute>
    <attribute name="RemoteAccess">true</attribute>
</mbean>

OLD EXTERNAL LDAP CONFIG for JBOSS Version 
2.4.4
--------------
sscldap.conf
--------------
java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFac
tory
java.naming.provider.url=ldap://192.9.200.5:389/dc=practi
ceit,dc=net
java.naming.security.principal=cn=SystemManager,dc=p
racticeit,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 -->
  <mbean code="org.jboss.naming.ExternalContext" 
name="jboss.jndi:service=ExternalContext,jndiName=ext
ernal/ldap/practiceit">
    <attribute 
name="JndiName">external/ldap/practiceit</attribute>
    <attribute 
name="Properties">/conf/sscldap.conf</attribute>
    <attribute 
name="InitialContext">javax.naming.ldap.InitialLdapCont
ext</attribute>
    <attribute name="RemoteAccess">true</attribute>
  </mbean>

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

java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFac
tory
java.naming.provider.url=ldap://192.9.200.5:389/dc=practi
ceit,dc=net
java.naming.security.principal=cn=SystemManager,dc=p
racticeit,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.invok
e(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.processR
equest(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.dispatc
h(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

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=601193&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to