繁体   English   中英

远程连接到JBoss 4.2.3的身份验证

[英]Authentication in Remote Connection to JBoss 4.2.3

我正在尝试连接到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);         

一切似乎在连接方面表现得很好,直到我得到的最后一行:

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)
:
:

安全域配置为使用JAAS(在jmx-invoker-service.xml中):

<interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
                 securityDomain="java:/jaas/jmx-console"/>

并且用户在jmx-console-users.properties中正确定义。

在我看来,校长根本没有被正确阅读。 JBoss使用的不是Context.SECURITY_PRINCIPAL / CREDENTIALS吗? 他们的命名文档中可以看出他们没有,但为什么会失败呢?

非常感谢,

-C

尝试设置初始上下文工厂,如下所示:

env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM