ya...client calls for service from tomcat, its a jsp page.
the request is served by the cmp runnin on jboss.
using windows nt professional.
actually context is found.
"System.out.println("Inside Server"+serverName);
Context ctx = getInitialContext();
System.out.println("Context Found");//this is printed
Object obj = ctx.lookup(serverName);"//so here is problm.
System.out.println("Lookup Completed");//this does not print
[ January 11, 2006: Message edited by: jaspal singh ]
///whole class is below:
package com.n4n.hello;
import java.util.*;
import java.rmi.*;
import java.rmi.registry.*;
import javax.naming.*;
import javax.rmi.*;
import javax.ejb.*;
public class ServerLookup
{
private static Context CONTEXT = null;
private static Hashtable SERVERS = new Hashtable();
private static Hashtable CLASS_MAPPINGS = new Hashtable();
public static final String HelloServerRemoteName = "HelloServer";
public static Object getServer(String serverName) throws RemoteException
{
Object server = null;
try{
System.out.println("Inside Server"+serverName);
Context ctx = getInitialContext();
System.out.println("Context Found");
Object obj = ctx.lookup(serverName);
System.out.println("Lookup Completed");
Class homeClass = getHomeClass(serverName);
System.out.println("Home Found");
EJBHome home = (EJBHome)PortableRemoteObject.narrow(obj, homeClass);
System.out.println("Narrow Completed");
server = homeClass.getDeclaredMethod("create", null).invoke(home, null);
System.out.println("Instance Created");
}
catch(Exception e)
{
e.printStackTrace();
}
return server;
}
private static Class getHomeClass(String remoteName) throws ClassNotFoundException
{
Class cls = (Class)CLASS_MAPPINGS.get(remoteName);
if(cls == null)
{
if(remoteName.equalsIgnoreCase(HelloServerRemoteName))
cls = Class.forName("com.n4n.hello.IHelloHome");
}
return cls;
}
public static InitialContext getInitialContext() throws javax.naming.NamingException
{
java.util.Hashtable JNDIParm = new java.util.Hashtable();
JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
JNDIParm.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
JNDIParm.put(Context.PROVIDER_URL, "192.168.111.79:2016");
return new InitialContext(JNDIParm);
}
}
[ January 11, 2006: Message edited by: jaspal singh ]