此为原来的
properties.put(Context.PROVIDER_URL, "192.168.1.25:1099");该为:
properties.put(Context.PROVIDER_URL, "rmi//192.168.1.25:1099");

properties.put(Context.PROVIDER_URL, "iiop//192.168.1.25:1099");错误变为:
javax.naming.CommunicationException: Receive timed out [Root exception is java.n
et.SocketTimeoutException: Receive timed out]补充:服务器是:Red Hat Linux release 9。

解决方案 »

  1.   

    String url = "t3://192.168.0.118:7001";
    Properties properties = null;
    properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    properties.put(Context.PROVIDER_URL, url);
    没问题呀
      

  2.   

    Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        properties.put(Context.PROVIDER_URL, "rmi://192.168.1.25:1099");我是这么设的,是不是不对啊??
      

  3.   

    帮你UP吧,JBOSS 没有用过。WB还可以了。
      

  4.   

    谢谢langjianjun(绝对在乎你) 现在不是说jboss用的人很多吗?在csdn中没有朋友用jboss做项目的吗?
      

  5.   

    应该是你原来那样的:
    Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        properties.put(Context.PROVIDER_URL, "192.168.1.25:1099");不过我没用过jboss... ------------------------------------------------------
               我们还年轻牛奶会有的奶牛也会有的 
                 可天天在 csdn 混这些会有吗 ??
      

  6.   


        private javax.naming.Context getJBossInitialContext() throws
            NamingException {
            java.util.Hashtable JNDIParm = new java.util.Hashtable();
            JNDIParm.put(Context.PROVIDER_URL, "127.0.0.1");
            JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY,
                         "org.jnp.interfaces.NamingContextFactory");
            return new InitialContext(JNDIParm);
        }
      

  7.   

    各位大大:
    我的jboss口在,客户端的ie中开服务器的192.168.1.25:1099口也有问题,说无法显示,我在本地测试的时候是一个乱码页(正常的显示)。
    ==================================================================
    to:starfeng(feng) 
        我怎么知道1099是否被占用,应该没有,服务器新配的,还没装多少东西呢。==================================================================
    to:bruni(不如你) 
         能解释一下吗,我看不懂,也不知道怎么加到我的程序中,我里面没这段。PS;我的CLIENT如下:import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import java.util.Properties;
    import com.javapro.ejb.StringProcessor;
    import com.javapro.ejb.StringProcessorHome;//客户端程序
    public class mClient {  public static void main(String[] args) {    // first argument must be the input
        if (args.length==0) {
          System.out.println("Please specify the input to convert to upper case.");
          return;
        }
        String input = args[0];    // preparing properties for constructing an InitialContext object
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        properties.put(Context.PROVIDER_URL, "192.168.1.25:1099");    try {
          // Get an initial context
          InitialContext jndiContext = new InitialContext(properties);
          System.out.println("Got context");      // Get a reference to the Bean
          Object ref  = jndiContext.lookup("StringProcessor");
          System.out.println("Got reference");      // Get a reference from this to the Bean's Home interface
          StringProcessorHome home = (StringProcessorHome)
            PortableRemoteObject.narrow (ref, StringProcessorHome.class);      // Create an Adder object from the Home interface
          StringProcessor sp = home.create();
          System.out.println ("Uppercase of '" + input + "' is " + 
            sp.toUpperCase(input));
        }
        catch(Exception e) {
          System.out.println(e.toString());
        }
      }
    }