Missing rmi URL context factory in GNU classpath ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    Hi,
 
In Carol project (used by JOnAS project), the RMI context factory is  
resolved by a call to the javax.naming.spi.NamingManager class [1].
 
With JVMs using GNU Classpath, the context returned by calling  
NamingManager.getURLContext(,) method is null, while with Sun/Bea/IBM  
JDK, it is non-null.
 
When looking at the GNU classpath class source code:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/naming/spi/NamingManager.java?rev=1.9&root=classpath&view=log 

 
There are some issues.
 
For example, there is the following code :
 
    if (prefixes == null)
      {
    // Specified as the default in the docs.  Unclear if this is
    // right for us.
    prefixes = "com.sun.jndi.url";
      }
 
By default, (see  
http://java.sun.com/j2se/1.3/docs/api/javax/naming/spi/NamingManager.html)  
it doesn't mean that it should not be added to the existing prefixes,  
and it is strange to add some sun prefixes in GNU classpath.
 
When using rmi as scheme, with Sun JVM, the expected class is  
"com.sun.jndi.url.rmi.rmiURLContextFactory" (as written in the guide  
http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-rmi.html ).
 
With GNU classpath, if we have a prefix (JOnAS case), it will then try  
to instantiate a class rmiURLContextFactory with different packages. But  
none of them will be found (and it doesn't search in com.sun.jndi.url  
package as there is already a package : prefixes != null).
 
I tried to search a rmiURLContextFactory class in GNU classpath but I  
didn't find one (with this name).
 
So, I think that a rmiURLContextFactory class and iiopURLContextFactory  
should be added in a GNU classpath package.
And that the default prefix to use should be the package containing the  
2 previous classes. Moreover, this prefix should be added for all cases  
(and not only when prefixes is null).
 
Without these classes, JOnAS couldn't run with RMI/JRMP, RMI/IRMI and  
RMI/IIOP (only jeremie should be working as the context factory is in  
jeremie package. But jeremie is deprecated and I want to run JOnAS with  
IRMI).
 
 
[1] example of code reproducing a NULL context by using GNU classpath  
(and a non-null context with proprietary jvm like Sun/Bea/IBM)
 
import java.util.Hashtable;
 
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.naming.spi.NamingManager;
public class TestJNDI {
 
    public static void main(String[] args) throws Exception {
 
        Hashtable env = new Hashtable();
        env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
        env.put(Context.INITIAL_CONTEXT_FACTORY,  
URLInitialContextFactory.class.getName());
        env.put(Context.URL_PKG_PREFIXES, "test.jndi");
 
        Context ctx = NamingManager.getURLContext("rmi", env);
        System.out.println("Ctx = " + ctx);
 
    }
 
    public class URLInitialContextFactory implements 
InitialContextFactory {
 
        public Context getInitialContext(Hashtable environment) throws  
NamingException {
            return null;
        }
    }
}
 
 
Regards,
 
Florent



[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux