[英]Authentication in Remote Connection to JBoss 4.2.3
I'm trying to connect to a JBoss MBean, but am getting blocked due to authentication failures. 我正在尝试连接到JBoss MBean,但由于身份验证失败而被阻止。
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://"+testIP+":"+testPort);
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
InitialContext ic = new InitialContext(env);
RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");
// Get the MBeanInfo for the JNDIView MBean
ObjectName name = new ObjectName("my.service:service=MyBean");
MBeanInfo info = server.getMBeanInfo(name);
Everything seems to behave fine in terms of connection until the last line when I get: 一切似乎在连接方面表现得很好,直到我得到的最后一行:
java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console
at org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:97)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
:
:
The security domain is configured to use JAAS (in the jmx-invoker-service.xml): 安全域配置为使用JAAS(在jmx-invoker-service.xml中):
<interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
securityDomain="java:/jaas/jmx-console"/>
And the user is defined in jmx-console-users.properties properly. 并且用户在jmx-console-users.properties中正确定义。
It appears to me that the principal is simply not being read properly. 在我看来,校长根本没有被正确阅读。 Does JBoss use something other than Context.SECURITY_PRINCIPAL/CREDENTIALS?
JBoss使用的不是Context.SECURITY_PRINCIPAL / CREDENTIALS吗? It appears from Their Naming Documentation that they do not, but why is this failing then?
从他们的命名文档中可以看出他们没有,但为什么会失败呢?
Many Thanks, 非常感谢,
-C -C
尝试设置初始上下文工厂,如下所示:
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.