配置 ctx.PROVIDER_URL 阿。
/**
* Constant that holds the name of the environment property
* for specifying configuration information for the service provider
* to use. The value of the property should contain a URL string
* (e.g. "ldap://somehost:389").
* This property may be specified in the environment,
* an applet parameter, a system property, or a resource file.
* If it is not specified in any of these sources,
* the default configuration is determined by the service provider.
*
* <p> The value of this constant is "java.naming.provider.url".
/**
* Constant that holds the name of the environment property
* for specifying configuration information for the service provider
* to use. The value of the property should contain a URL string
* (e.g. "ldap://somehost:389").
* This property may be specified in the environment,
* an applet parameter, a system property, or a resource file.
* If it is not specified in any of these sources,
* the default configuration is determined by the service provider.
*
* <p> The value of this constant is "java.naming.provider.url".
哪位高手指点指点!
中间件没有home接口你怎么实例化远程接口???
到时候发布的时候用工具把home打包也要给客户的!我是这么认为的。如果有误,是我错。
但我还是请你先看看相关文档。。
不要想当然。
只是一些好的工具会自动帮你生成。还有一些应用服务器还能够自己
生成服务端的部署类。但原理依然是这样。如果你看看一些工具生成的
客户端代码,你会明白很多他实际工作的原理
不过,我还是有些问题想请教:
在本地实例化,也在本地调用,执行却在远端。一来一去,效率勘忧。能告诉我具体的实例化过程吗?从jndi查找到本地本地实例化。以及调用方法时是如何让远端得到消息并运行返回结果的?
关于配置:用welogic为例子:
Properties prop= new Properties ();
prop.put(ctx.INITIAL_CONTEXT_FACTORY , "weblogic.jndi.WLInitialContextFactory");
prop.put(ctx.PROVIDER_URL = “t3://yourEJBServerIP:7001“);
ctx = new InitialContext(prop);