0
我有獨立的應用程序連接到Wildfly服務器以獲取EJB代理。這是Maven項目,作爲一個依賴我:Wildfly上的遠程EJB
<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);
一切工作正常,但服務器不要求用戶名和密碼。如何添加身份驗證?