我正在使用DataStax Java Driver 2.17,并收到以下错误:
Caused by: io.netty.channel.ChannelException: Unable to create Channel from class class io.netty.channel.socket.nio.NioSocketChannel
at io.netty.bootstrap.AbstractBootstrap$BootstrapChannelFactory.newChannel(AbstractBootstrap.java:455) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:306) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.bootstrap.Bootstrap.doConnect(Bootstrap.java:133) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:115) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at com.datastax.driver.core.Connection.initAsync(Connection.java:136) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.HostConnectionPool.initAsync(HostConnectionPool.java:119) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.SessionManager.replacePool(SessionManager.java:265) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:301) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.SessionManager.createPoolsInParallel(SessionManager.java:81) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.SessionManager.init(SessionManager.java:70) ~[cassandra-driver-core-2.1.7.jar:na]
at com.datastax.driver.core.Cluster.connect(Cluster.java:251) ~[cassandra-driver-core-2.1.7.jar:na]
at com.symantec.nsp.cassandra.CassandraConnector.getSession(CassandraConnector.java:80) ~[cassandra-client-1.0.1-SNAPSHOT.jar:na]
at com.symantec.nsp.storageservice.dao.impl.cassandra.BucketDAOImpl.upsert(BucketDAOImpl.java:45) ~[storageservice-cassandra-1.0.0-SNAPSHOT.jar:na]
at com.symantec.nsp.storageservice.dao.impl.cassandra.BucketDAOImpl.create(BucketDAOImpl.java:34) ~[storageservice-cassandra-1.0.0-SNAPSHOT.jar:na]
at com.symantec.nsp.storageservice.service.impl.BucketServiceImpl.createBucket(BucketServiceImpl.java:79) ~[BucketServiceImpl.class:na]
... 76 common frames omitted
Caused by: io.netty.channel.ChannelException: Failed to open a socket.
at io.netty.channel.socket.nio.NioSocketChannel.newSocket(NioSocketChannel.java:62) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:72) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at sun.reflect.GeneratedConstructorAccessor42.newInstance(Unknown Source) ~[na:na]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_20]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_20]
at java.lang.Class.newInstance(Class.java:433) ~[na:1.8.0_20]
at io.netty.bootstrap.AbstractBootstrap$BootstrapChannelFactory.newChannel(AbstractBootstrap.java:453) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
... 90 common frames omitted
Caused by: java.net.SocketException: Too many open files
at sun.nio.ch.Net.socket0(Native Method) ~[na:1.8.0_20]
at sun.nio.ch.Net.socket(Net.java:415) ~[na:1.8.0_20]
at sun.nio.ch.Net.socket(Net.java:408) ~[na:1.8.0_20]
at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:105) ~[na:1.8.0_20]
at sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:60) ~[na:1.8.0_20]
at io.netty.channel.socket.nio.NioSocketChannel.newSocket(NioSocketChannel.java:60) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
有什么好办法来解决这个问题吗?
2条答案
按热度按时间ep6jt1vc1#
请确保您的系统符合recommended production settings。您可能必须使用
limits.conf
中的nofile
设置来增加打开文件的最大数量。s4n0splo2#
通过仅创建会话的一个示例修复了此问题。已根据请求创建早期会话。