We use some kind of cache of HomeHandle objects in a remote JVM that obtains 
the Home object using the following code:

       Hashtable environment = new Hashtable();

        environment.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
        environment.put(Context.URL_PKG_PREFIXES, 
"org.jboss.naming:org.jnp.interfaces");
        environment.put(Context.PROVIDER_URL, "jnp://localhost:1099"); 
        InitialContext context;
                try {
                        context = new InitialContext(environment);
                Object obj = context.lookup("ejb/EJBTest"); //ejb-name
                 EJBHome home = 
(EJBHome)PortableRemoteObject.narrow(obj,EJBTestHome.class); // (1)
                 
                  ...
                 
               } catch (NamingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        
After (1) we store the HomeHandle of the EJBHome object in that way we can use 
it in a latter time saving the overhead of the lookup opeartion. BUT we get the 
following error when we invoke getEJBHome() on the stored HomeHandle object.

Caused by: java.rmi.ServerException: Could not get EJBHome; nested exception 
is: 
        javax.naming.NoInitialContextException: Need to specify class name in 
environment or system property, or as an applet parameter, or in an application 
resource file:  java.naming.factory.initial
        at 
org.jboss.proxy.ejb.handle.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:107)
        at 
communication.serviceLocator.EJBServiceLocator.getService(EJBServiceLocator.java:68)
        ... 2 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name 
in environment or system property, or as an applet parameter, or in an 
application resource file:  java.naming.factory.initial
        at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
        at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
        at 
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at 
org.jboss.proxy.ejb.handle.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:102)
        ... 3 more

Anyone know why it is not working ? Anyone knows if there is a problem using a 
remote client (that lives outside de Jboss JVM) that stores/retrieve the 
HomeHandle of an EJBHome object that resides in the JBoss JVM.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005947#4005947

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005947
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to