javax.jms.JMSSecurityException:无法验证user:null

环境:

Jboss 7.1.0
操作系统Windows

我正在尝试一个简单的测试,使用Jboss和内置的HornetQ JMS提供程序来试用JMS.经过大量的游戏,我设法得到了这种配置的响应

        final Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        env.put(Context.PROVIDER_URL, "remote://localhost:4447");
        env.put(Context.SECURITY_PRINCIPAL, "appuser2");
        env.put(Context.SECURITY_CREDENTIALS, "s3cr3t");        

但问题是,当我运行它时,我收到以下错误:

javax.jms.JMSSecurityException: Unable to validate user: null
    at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:286)
    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:695)
    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:264)
    at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:589)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:694)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:121)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)
    at com.jms.client.ConsoleClient.runExample(ConsoleClient.java:51)
    at com.jms.client.ConsoleClient.main(ConsoleClient.java:20)
Caused by: HornetQException[errorCode=105 message=Unable to validate user: null]
    ... 9 more

我一直在寻找谷歌,每个例子似乎都指向如何配置HornetQ作为独立服务器的安全设置.我无法弄清楚如何在Jboss上配置用户以及我是否需要.

有任何想法吗?

最佳答案
我同意Sergiu并且会添加队列,无需用户名和密码即可设置.

转载注明原文:javax.jms.JMSSecurityException:无法验证user:null - 代码日志