Search code examples
javaoraclejbossldapoid

Connection reset exception while trying to contact an Oracle LDAP server from JBOSS


Getting the following error when trying to contact oracle LDAP from JBOSS. Immediately after deploying into JBOSS the connection works fine. After around ten minutes , i'm getting this error.If i again remove and redeploy the application into JBOSS the same thing happens again.It stops working after 10 minutes.Please provide your valuable suggesstions.

2015-11-30_02:25:28 c.t.c.c.CASSelfServiceRestController createUser 116 - INFO  --- 10.48.120.22 SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328
2015-11-30_02:25:28 c.t.c.c.CASSelfServiceRestController createUser 126 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328 [email protected]
2015-11-30_02:25:28 c.t.c.s.s.ServiceProviderImpl createUser 99 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328 [email protected]
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 995 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1026 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328  Response to Service Layer
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1030 - INFO  --- Query : ([email protected])
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1033 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328  Response to Service Layer
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1039 - INFO  --- Search User : Connection reset; nested exception is javax.naming.CommunicationException: Connection reset [Root exception is java.net.SocketException: Connection reset]; remaining name 'ou=people,ou=lexus,ou=lexusconsumers,o=teds'
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1040 - INFO  --- LdapTemplate Object : org.springframework.ldap.core.LdapTemplate@28f807ec
2015-11-30_02:25:28 c.t.c.d.d.DAOProviderImpl searchUser 1041 - INFO  --- StackTrace : org.springframework.ldap.CommunicationException: Connection reset; nested exception is javax.naming.CommunicationException: Connection reset [Root exception is java.net.SocketException: Connection reset]; remaining name 'ou=people,ou=lexus,ou=lexusconsumers,o=teds'
    at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:100)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:318)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:258)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:570)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:555)
    at com.toyota.casservice.dao.daoproviderimpl.DAOProviderImpl.searchUser(DAOProviderImpl.java:1031)
    at com.toyota.casservice.service.serviceproviderimpl.ServiceProviderImpl.createUser(ServiceProviderImpl.java:119)
    at com.toyota.casservice.controller.CASSelfServiceRestController.createUser(CASSelfServiceRestController.java:129)
    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.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
    at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
    at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)
    at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javax.naming.CommunicationException: Connection reset [Root exception is java.net.SocketException: Connection reset]; remaining name 'ou=people,ou=lexus,ou=lexusconsumers,o=teds'
    at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:2003)
    at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847)
    at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339)
    at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267)
    at org.springframework.ldap.pool.DelegatingDirContext.search(DelegatingDirContext.java:347)
    at org.springframework.ldap.core.LdapTemplate$4.executeSearch(LdapTemplate.java:252)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:292)
    ... 63 more
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:196)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at com.sun.jndi.ldap.Connection.run(Connection.java:853)
    ... 1 more

2015-11-30_02:25:28 c.t.c.s.s.ServiceProviderImpl createUser 168 - ERROR --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328 [email protected] Error Code: 26
2015-11-30_02:25:28 c.t.c.c.e.GenericExceptionHandler toResponse 28 - ERROR --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328 Error Code: 19
2015-11-30_02:25:28 c.t.c.c.e.GenericExceptionHandler toResponse 32 - INFO  --- SXM 5955d46b-a8f9-251e-9b88-fcc11c0c8328 Error Code: 19 Response Sent Out <--

Solution

  • You should check that the context is correct and there are users in that context: ou=people,ou=lexus,ou=lexusconsumers,o=teds.

    You can use something like JXplorer to verify if the context is correct.

    If that context is correct, then try increasing the read and connection timeouts that are on the directory side. Increasing these values may allow the operation to complete and prevent the connection reset issue.