我的项目中有两个模块:
JBoss 6 服务器:
import javax.ejb.*;
@Remote
public interface srv_interface {
public int test();
}
@Stateless
public class srv_class implements srv_interface {
public int test()
{
return 999;
}
}
客户端:
public class Main
{
public static void main( String[] arg ) throws Exception
{
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.setProperty("java.naming.provider.url", "jnp://127.0.0.1:1099");
Context context = new InitialContext(props);
Object connectionFacadeRemote = context.lookup("srv_class/remote");
srv_interface exampleService = (srv_interface) connectionFacadeRemote; // can't get srv_interface anywhere...
}
}
问题是客户端看不到 srv_interface。如何使客户端模块可见“srv_interface”?