【发布时间】:2014-08-22 08:49:45
【问题描述】:
我有独立的应用程序连接到 Wildfly 服务器以获得 EJB 代理。这是 maven 项目,作为我的依赖项:
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>8.0.0.Final</version>
<type>pom</type>
</dependency>
要获取我正在使用的 EJB:
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
env.put("jboss.naming.client.ejb.context", true);
InitialContext remoteContext = new InitialContext(env);
String jndi = "jndi";
RemoteInterface lookup = (RemoteInterface) remoteContext.lookup(jndi);
一切正常,但服务器没有要求输入用户名和密码。如何添加认证?
【问题讨论】: