0

我写信是为了寻求帮助。简而言之,我正在尝试使用 com.unboundid.ldap.sdk(但这不是必需的 - 如果我使用 oracle 的 javax.naming.ldap.* 会遇到同样的问题)来处理 ldap 事务,我得到了以下错误:

线程“主线程”java.lang.AssertionError 中的异常:结果 EndTransactionExtendedResult(resultCode=2 (protocol error), diagnosticMessage='protocol error')没有预期的结果代码“0(成功)”。在 com.unboundid.util.LDAPTestUtils.assertResultCodeEquals(LDAPTestUtils.java:1484) 在 pkg.Main.main(Main.java:116)

我的程序如下(我使用来自https://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/extensions/StartTransactionExtendedRequest.html的简单示例):

public class Main {
    public static void main( String[] args ) throws LDAPException {

        LDAPConnection connection = null;
        try {
    connection = new LDAPConnection("***", ***, "***", "***");
        } catch (LDAPException e1) {
            e1.printStackTrace();
        }

        // Use the start transaction extended operation to begin a transaction.
         StartTransactionExtendedResult startTxnResult;
         try
         {
           startTxnResult = (StartTransactionExtendedResult)
                connection.processExtendedOperation(
                     new StartTransactionExtendedRequest());
           // This doesn't necessarily mean that the operation was successful, since
           // some kinds of extended operations return non-success results under
           // normal conditions.
         }
         catch (LDAPException le)
         {
           // For an extended operation, this generally means that a problem was
           // encountered while trying to send the request or read the result.
           startTxnResult = new StartTransactionExtendedResult(
                new ExtendedResult(le));
         }
         LDAPTestUtils.assertResultCodeEquals(startTxnResult, ResultCode.SUCCESS);
         ASN1OctetString txnID = startTxnResult.getTransactionID();


         // At this point, we have a transaction available for use.  If any problem
         // arises, we want to ensure that the transaction is aborted, so create a
         // try block to process the operations and a finally block to commit or
         // abort the transaction.
         boolean commit = false;
         try
         {
             // do nothing
         }
         finally
         {
           // Commit or abort the transaction.
           EndTransactionExtendedResult endTxnResult;
           try
           {
             endTxnResult = (EndTransactionExtendedResult)
                  connection.processExtendedOperation(
                       new EndTransactionExtendedRequest(txnID, commit));
           }
           catch (LDAPException le)
           {
             endTxnResult = new EndTransactionExtendedResult(new ExtendedResult(le));
           }
           LDAPTestUtils.assertResultCodeEquals(endTxnResult, ResultCode.SUCCESS);
         }
    }
}

如您所见,我对事务什么都不做:只是启动并回滚,但它仍然无法正常工作。连接正常,我收到事务 id = F10285501E20C32AE040A8C0070F7502但它总是一样的- 都是 wrigth 吗?如果“//什么都不做”替换为一些动作异常:不愿意执行

我开始认为这是 OID 问题,但我就是不知道出了什么问题…… OID 在 WebLogic 服务器上,它的版本是:

版本信息

ODSM 11.1.1.6.0

OID 11.1.1.6.0

数据库 11.2.0.2.0

所有的想法将不胜感激。

4

0 回答 0