0

I have a problem with JNDI lookup for remote interface There is 2 servers: - first main server; - second slave server (it will be more than one, but now just one); The main server should connect to the slave to update metadata, but when it looked up a remote interface it got a local one (both servers has same interfaces).

declaration of interface

@Remote
public interface IMetadataRemote {

implementation

@Remote(IMetadataRemote.class)
@Stateless(mappedName = "MetadataSync")
public class MetadataRemoteImpl implements IMetadataRemote {

look up code:

    Properties jndiProps = new Properties();

    jndiProps.put("java.naming.factory.initial", "com.sun.enterprise.naming.impl.SerialInitContextFactory");
    jndiProps.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
    jndiProps.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");

    jndiProps.setProperty("org.omg.CORBA.ORBInitialHost", serviceIp);
    jndiProps.setProperty("org.omg.CORBA.ORBInitialPort", servicePort);

    Context ctx = new InitialContext(jndiProps);
    IMetadataRemote metadataRemote = (IMetadataRemote) ctx.lookup("MetadataSync");

What should I do to make it work?

Serg
  • 1
  • 1
  • 2

0 Answers0