geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Meany <dan_me...@yahoo.com>
Subject EJB global JNDI entries
Date Fri, 09 Dec 2005 19:34:58 GMT
I have an app that works in JBoss, WebSphere and
Weblogic with the same .ear binary.  I am having
trouble with Geronimo either not seeing or not
publishing the session EJBs in JNDI.  There does not
appear to be anything in the global JNDI tree.  With
JBoss, I don't have to use any vendor-specific xml
files and it creates some JNDI entries automatically
for the EJBs.

My test openejb-jar.xml looks like:

<openejb-jar
    xmlns="http://www.openejb.org/xml/ns/openejb-jar"
   
xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
   
xmlns:security="http://geronimo.apache.org/xml/ns/security"
   
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
    configId="myappj" 
    parentId="myapp"
    >
 <enterprise-beans>
 	
  <session>
    <ejb-name>LoginEJB</ejb-name>
    <jndi-name>LoginEJB</jndi-name>
  </session>
  
<!--  ... other beans deleted  -->

 </enterprise-beans>
    
</openejb-jar>

I am attempting to print out the JNDI tree with this
code (works with JBoss, but only one JMX item is
returned for Geronimo): 

logger.debug("----- Contents of Global JNDI namespace
-----");
printjnditree("");
logger.debug("----- Contents of 'java:' JNDI namespace
-----");
printjnditree("java:");
logger.debug("----------------------------------------------");

    private static void printjnditree(String ns) {
    	try {
    		printjnditree(ns, new InitialContext(), "");
    	} catch (Exception e) {
    		logger.error(e);
    	}
    }
    
    private static void printjnditree(String name,
Context ctx, String indent) {
    	try {
           NamingEnumeration n =
ctx.listBindings(name);
           while (n.hasMore()) {
              try {
                 Binding b = (Binding)n.next();
                 String bname = b.getName();
                 String clsname = b.getClassName();
                 Class cls = b.getClass();
                 Object o = b.getObject();
                 logger.debug(indent + bname + "
(class: "+clsname+")");
                 if
(clsname.equals("javax.naming.Context") || o
instanceof javax.naming.Context) {
                    if (!name.endsWith(":")) name =
name + "/";
                    printjnditree(name + bname, ctx,
indent + "  ");
                 }
              } catch (Exception e) {
                    //System.out.println(""+e);
              }
           }
    	} catch (Exception e) {
    		//System.out.println(""+e);
    	}
    }



Mime
View raw message