我写信是为了得到一些帮助。 简而言之,我正在尝试使用com.unboundid.ldap.sdk(但是没有必要 - 如果我使用oracle的javax.naming.ldap。*来获得同样的问题来处理ldap事务,我得到了以下错误:
线程“主线程”中的异常java.lang.AssertionError:结果EndTransactionExtendedResult(resultCode = 2(协议错误),diagnosticMessage ='协议错误')没有预期的结果代码为'0(成功)'。 at 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 但它总是相同 - 这一切都是错误的吗??? 如果“//什么都不做”会替换某些操作例外:不愿意执行。
我开始认为这是OID问题,但我无法弄清楚出了什么问题...... OID位于WebLogic服务器上,其版本为:
版本信息
ODSM 11.1.1.6.0
OID 11.1.1.6.0
DB 11.2.0.2.0
所有想法都将受到赞赏。