javax.naming.CommunicationException:请求:2已取消

时间:2018-02-13 15:52:30

标签: java spring

在确定是否有更多元素(枚举)被应用程序捕获和处理时,我得到此异常。

 

    com.app.fr.chrom.batch.model.exception.ReaderException: com.app.fr.chrom.model.exception.TechnicalException: javax.naming.CommunicationException: Request: 2 cancelled
        at com.app.fr.chrom.batch.ldap.reader.LdapItemReader.open(LdapItemReader.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy32.open(Unknown Source)
        at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:96)
        at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:306)
        at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:192)
        at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:141)
        at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
        at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
        at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151)
        at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130)
        at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
        at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:127)
        at com.app.fr.c4batch.C4Batch.launch(C4Batch.java:136)
        at com.app.fr.c4batch.BatchLauncher.main(BatchLauncher.java:54)
    Caused by: com.app.fr.chrom.model.exception.TechnicalException: com.app.fr.chrom.model.exception.TechnicalException: javax.naming.CommunicationException: Request: 2 cancelled
        at com.app.fr.chrom.batch.service.impl.CollabLdapService.retrieveModifiedCollaborateur(CollabLdapService.java:116)
        at com.app.fr.chrom.batch.ldap.reader.LdapItemReader.open(LdapItemReader.java:77)
        ... 27 more
    Caused by: com.app.fr.chrom.model.exception.TechnicalException: javax.naming.CommunicationException: Request: 2 cancelled
        at com.app.fr.chrom.dao.ldapimpl.RetrieveCollaborateurLdap.retrieveLastModified(RetrieveCollaborateurLdap.java:142)
        at com.app.fr.chrom.batch.service.impl.CollabLdapService.retrieveModifiedCollaborateur(CollabLdapService.java:82)
        ... 28 more
    Caused by: javax.naming.CommunicationException: Request: 2 cancelled
        at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:105)
        at com.sun.jndi.ldap.Connection.readReply(Connection.java:452)
        at com.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:638)
        at com.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:606)
        at com.sun.jndi.ldap.LdapCtx.getSearchReply(LdapCtx.java:1920)
        at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:129)
        at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:216)
        at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:189)
        at com.app.fr.chrom.dao.ldapimpl.RetrieveCollaborateurLdap.retrieveLastModified(RetrieveCollaborateurLdap.java:97)
        ... 29 more 
This my code:

<pre>

     InitialDirContext ctxLdap = new InitialDirContext(envLdap);
     final NamingEnumeration<?> userSearch = ctxLdap.search(getUsersSuffixDN(), searchFilter, searchControls);
     while (userSearch.hasMore()) {...} // <b>The HasMore method throws   <i>javax.naming.CommunicationException</i></b>

此方法很少抛出此异常,但我想知道它为什么会发生。谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

当您有注册用户并尝试再次注册时,可能会发生这种情况。