ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

NFA API OData randomly fails

book

Article ID: 213513

calendar_today

Updated On:

Products

CA Network Flow Analysis (NetQos / NFA)

Issue/Introduction

Check to see if you see this error in your D:\CA\NFA\OData\logs\odata-wrapper.log log: 

2021-04-06 23:41:36.821 ERROR 2352 --- [request_worker_thread_8] c.c.n.o.p.ODataEntityCollectionProcessor : Read Entity Collection failed: {0} 

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.

This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable. 

For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.

For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
 at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81)
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:600)
 at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:657)
 at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:682)
 at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:736)
 at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:212)
 at com.ca.nfa.odata.authservice.dao.RoleDefinitionsDao.getByRoleId(RoleDefinitionsDao.java:43)
 at com.ca.nfa.odata.authservice.dao.RoleDefinitionsDao$$FastClassBySpringCGLIB$$ee898842.invoke(<generated>)
 at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
 at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
 at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
 at com.ca.nfa.odata.authservice.dao.RoleDefinitionsDao$$EnhancerBySpringCGLIB$$34c32357.getByRoleId(<generated>)
 at com.ca.nfa.odata.authservice.impl.AuthorizationServiceImpl.verifyViewPermissions(AuthorizationServiceImpl.java:108)
 at com.ca.nfa.odata.repository.impl.ODataStore.isAuthorizedToView(ODataStore.java:98)
 at com.ca.nfa.odata.repository.impl.ODataStore.readExpandedEntitySet(ODataStore.java:178)
 at com.ca.nfa.odata.processor.ODataEntityCollectionProcessor.readEntityCollectionInternal(ODataEntityCollectionProcessor.java:173)
 at com.ca.nfa.odata.processor.ODataEntityCollectionProcessor.readEntityCollection(ODataEntityCollectionProcessor.java:115)
 at org.apache.olingo.server.core.ODataDispatcher.handleEntityCollectionDispatching(ODataDispatcher.java:528)
 at org.apache.olingo.server.core.ODataDispatcher.handleEntityDispatching(ODataDispatcher.java:510)
 at org.apache.olingo.server.core.ODataDispatcher.handleResourceDispatching(ODataDispatcher.java:151)
 at org.apache.olingo.server.core.ODataDispatcher.dispatch(ODataDispatcher.java:117)
 at org.apache.olingo.server.core.ODataHandlerImpl.processInternal(ODataHandlerImpl.java:164)
 at org.apache.olingo.server.core.ODataHandlerImpl.process(ODataHandlerImpl.java:85)
 at org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:74)
 at org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:88)
 at com.ca.nfa.odata.ODataService.process(ODataService.java:76)
 at com.ca.nfa.odata.servlet.request.util.AsyncRequestTask.run(AsyncRequestTask.java:46)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.

This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable. 

For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.

For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
 at sun.reflect.GeneratedConstructorAccessor121.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:988)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
 at sun.reflect.GeneratedConstructorAccessor94.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
 at java.sql.DriverManager.getConnection(DriverManager.java:664)
 at java.sql.DriverManager.getConnection(DriverManager.java:208)
 at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:154)
 at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:145)
 at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
 at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169)
 at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:169)
 at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:151)
 at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
 at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
 ... 32 common frames omitted
Caused by: java.net.BindException: Address already in use: connect
 at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
 at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
 at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
 at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
 at java.net.Socket.connect(Socket.java:607)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
 ... 53 common frames omitted

Cause

As the error states: This is usually caused by a limit on the number of sockets imposed by the operating system. 

Environment

Network Flow Analysis

Resolution

1. On the NFA console, hit start, then run and open the Registry Editor by typing regedit from the run command.

2. Locate the following subkey in the registry, and then click "Parameters":

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

3. On the Edit menu, click New, and then add the following registry entry:

Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534

4. Reboot the machine.