JBoss Community

Re: javax.naming.CommunicationException

created by Derya Altuntas in JNDI and Naming - View the full discussion

I am receiving same error.My client class is below.In lookup method Communication error exits.I will send print of JMX-Console service=Naming

screen.I see that my port is 1098.I am setting correct URL?

 

public class Test {

/**
  * @param args
  */
public Test() {
}


public static void main(String[] args) throws FileNotFoundException, IOException, SecurityException{
  Test searchFacadeTest = new Test();
  searchFacadeTest.doTest();
}


public void doTest() throws FileNotFoundException, IOException{
  try {

   Context jndiContext = getInitialContext();
   FileManagerBeanRemote fileManager= (FileManagerBeanRemote)jndiContext.lookup("FileManagerBean/remote");
   //fileManager.moveFile("C:\\test.txt", "C:\\Documents and Settings\\tr1a6358\\bowling.txt");
  }
  catch (Exception e) {
   e.printStackTrace();
  }
}

// developed for JBoss only. this is vender dependency
public static Context getInitialContext( ) throws javax.naming.NamingException {
  Properties p = new Properties( );
  p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  p.put(Context.PROVIDER_URL, "jnp://localhost:1098");
  Context context = new InitialContext(p);
  return context;
}

}

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community