[jboss-cvs] JBossAS SVN: r59351 - trunk/server/src/main/org/jboss/naming/client/java

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 4 09:08:03 EST 2007


Author: wolfc
Date: 2007-01-04 09:08:00 -0500 (Thu, 04 Jan 2007)
New Revision: 59351

Modified:
   trunk/server/src/main/org/jboss/naming/client/java/javaURLContextFactory.java
Log:
JBAS-3967: Hack for EJB3 client enc

Modified: trunk/server/src/main/org/jboss/naming/client/java/javaURLContextFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/naming/client/java/javaURLContextFactory.java	2007-01-04 14:04:16 UTC (rev 59350)
+++ trunk/server/src/main/org/jboss/naming/client/java/javaURLContextFactory.java	2007-01-04 14:08:00 UTC (rev 59351)
@@ -27,8 +27,11 @@
 import java.lang.reflect.Proxy;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.InitialContext;
 import javax.naming.OperationNotSupportedException;
@@ -36,6 +39,7 @@
 import javax.naming.spi.ObjectFactory;
 
 import org.jboss.corba.ORBFactory;
+import org.jboss.logging.Logger;
 
 /** The external client java URL context factory. This is used in conjunction
  * with j2ee application clients to implement the java:comp/env
@@ -49,6 +53,8 @@
 public class javaURLContextFactory
    implements ObjectFactory
 {
+   private static final Logger log = Logger.getLogger(javaURLContextFactory.class);
+   
    public static final String J2EE_CLIENT_NAME_PROP = "j2ee.clientName";
 
    // ObjectFactory implementation ----------------------------------
@@ -130,9 +136,18 @@
             return getSpecialObject(name);
          // Lookup the client application context from the server
          Context clientCtx = (Context) lookupCtx.lookup(clientName);
+         
+         // EJB3 Client container hack
+         NamingEnumeration<NameClassPair> e = clientCtx.list("env");
+         if(e.hasMore())
+         {
+            clientCtx = (Context) clientCtx.lookup("env");
+         }
+         
          // Strip the comp/env prefix
          Name bindingName = name.getSuffix(2);
          Object binding = clientCtx.lookup(bindingName);
+         
          return binding;
       }
       




More information about the jboss-cvs-commits mailing list