【发布时间】:2017-06-15 03:12:38
【问题描述】:
我正在尝试对我的 Wildfly 10/JBoss 7 EAP 服务器进行远程 EJB 调用,但在我的 Wildfly 服务器上不断收到 Invalid User 错误消息(我的 EJB 称为 LoginManager):
23:04:02,872 ERROR [org.jboss.as.ejb3.invocation] (default task-6) WFLYEJB0034: EJB Invocation failed on component LoginManager for method public abstract java.lang.String ejbs.LoginManagerRemote.echo(java.lang.String): javax.ejb.EJBAccessException: WFLYSEC0027: Invalid User
at org.jboss.as.ejb3.security.SecurityContextInterceptor$1.run(SecurityContextInterceptor.java:69)
at org.jboss.as.ejb3.security.SecurityContextInterceptor$1.run(SecurityContextInterceptor.java:49)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:97)
我已使用 add-user.sh/bat 脚本将我的用户添加到 application-users.properties 文件中。
我尝试在 Wildfly 服务器本身的第 54 行的 SecurityContextInterceptor 类中设置断点,发现主体为空:
if (holder.skipAuthentication == false) {
holder.securityManager.authenticate(holder.runAs, holder.runAsPrincipal, holder.extraRoles);
我不完全确定 runAs 或 runAsPrincipal 是否是远程 EJB 调用传递的主体/凭据,但我怀疑它可能是我的问题的原因。
我将远程 ejb 称为:
Properties p = new Properties();
p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final Context context = new InitialContext(p);
LoginManagerRemote ejb = (LoginManagerRemote) context.lookup("ejb:ear-1.0/ejbs-1.0//LoginManager!ejbs.LoginManagerRemote");
return ejb.echo("test");
我的 jboss-ejb-client.properties 为:
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port=8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.conncetion.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER
remote.connection.default.username=test
remote.connection.default.password=test
我做错了吗?我在某处遗漏了一些明显的东西吗?我需要做什么才能成功调用远程 EJB?
【问题讨论】:
-
这个问题你解决了吗?
标签: jboss ejb wildfly-10