使用java连接到ESB时出现不真实的客户端错误

时间:2017-06-13 04:15:33

标签: java jms esb initial-context sonic

我正在尝试使用java代码连接到ESB代理,如下所示。我已经确认我们使用的用户名和密码是正确的。我仍然收到此错误。可能是造成此错误的原因是什么?

Caused by: [2101] progress.message.client.EInauthenticClient: Inauthentic Client
               at progress.message.client.EGeneralException.<init>(EGeneralException.java:43)
               at progress.message.client.ESecurityGeneralException.<init>(ESecurityGeneralException.java:23)
               at progress.message.client.ESecurityPolicyViolation.<init>(ESecurityPolicyViolation.java:32)
               at progress.message.client.EInauthenticClient.<init>(EInauthenticClient.java:27)
               at progress.message.zclient.Connection.connectWithRecoveryOpt(Connection.java:1055)
               at progress.message.zclient.ReconnectHelper.connectAndChaseSingleFailoverRedirect(ReconnectHelper.java:534)
               at progress.message.zclient.ReconnectHelper.connect(ReconnectHelper.java:367)
               at progress.message.zclient.Connection.connect(Connection.java:1562)
               at progress.message.jimpl.Connection.<init>(Connection.java:854)

Java代码:

Hashtable env = new Hashtable();
       env.put("java.naming.factory.initial", JNDI_FACTORY);
       env.put("java.naming.provider.url", provideURL);
       env.put(Context.SECURITY_PRINCIPAL, userName);
       env.put(Context.SECURITY_CREDENTIALS, password);
       env.put(com.sonicsw.jndi.mfcontext.domain, domainName);

InitialContext ctx = new InitialContext(env);
 qconFactory = (QueueConnectionFactory)ctx.lookup(JMS_FACTORY);
 qcon = qconFactory.createQueueConnection();

1 个答案:

答案 0 :(得分:0)

它适用于以下代码。为createQueueConnection方法添加了用户名和密码参数,并且工作正常。 :)

Hashtable env = new Hashtable();
       env.put("java.naming.factory.initial", JNDI_FACTORY);
       env.put("java.naming.provider.url", provideURL);
       env.put(Context.SECURITY_PRINCIPAL, userName);
       env.put(Context.SECURITY_CREDENTIALS, password);
       env.put(com.sonicsw.jndi.mfcontext.domain, domainName);

InitialContext ctx = new InitialContext(env);
 qconFactory = (QueueConnectionFactory)ctx.lookup(JMS_FACTORY);
 qcon = qconFactory.createQueueConnection(userName, password);