MongoDB java.net.ConnectException: Connection refused - mongodb

I have problem with used MongoDB
I am testing a web aplication use Jmeter test.
When set up a big load, on the web application, it is right.
When set up a low load but many users, it is beginning exception..
java.net.ConnectException: Connection
refused: connect at
java.net.PlainSocketImpl.socketConnect(Native
Method) at
java.net.PlainSocketImpl.doConnect(Unknown
Source) at
java.net.PlainSocketImpl.connectToAddress(Unknown
Source) at
java.net.PlainSocketImpl.connect(Unknown
Source) at
java.net.SocksSocketImpl.connect(Unknown
Source) at
java.net.Socket.connect(Unknown
Source) at
sun.net.NetworkClient.doConnect(Unknown
Source) at
sun.net.www.http.HttpClient.openServer(Unknown
Source) at
sun.net.www.http.HttpClient.openServer(Unknown
Source) at
sun.net.www.http.HttpClient.(Unknown
Source) at
sun.net.www.http.HttpClient.New(Unknown
Source) at
sun.net.www.http.HttpClient.New(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
Source) at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:483)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:965)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:951)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:348)
at
org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
at java.lang.Thread.run(Unknown
Source)
Tell me please, why..? (I use MongoDB, Tomcat, Java)Thanks..

This is the type of error you should expect to see when load testing any web application with a tool like JMeter, and tells you that you're hitting the upper limit of transactions that the app can support... and this is where you'd do some tweaking of the settings to get better results.
The error message is saying that there are too many HTTP connections going at once and Tomcat is overwhelmed. I'm not sure which version of Tomcat you're on, but it looks like the default for Tomcat 6 is to queue up to 100 requests, then refuse any after that, and maxes out at 200 threads. Try increasing the "acceptCount" or "maxThreads" and see if that helps.
You may also try retagging the question, since this is a broader problem that affects more than just MongoDB apps... and you should get more replies that way. ;)

Related

Blocked Thread Exception While Using BR-POP and Socket

We have running 1 vert.x Server connected with redis and DB for running Messenger App.
5~7 people(client) connected to redis simultaneously.
when we send a message to others or do some task processing via Web Socket.
WARNING: Thread Thread[vert.x-worker-thread-4,5,main] has been blocked for 74241 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:195)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:141)
at redis.clients.jedis.Protocol.read(Protocol.java:205)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:233)
at redis.clients.jedis.Connection.getMultiBulkReply(Connection.java:226)
at redis.clients.jedis.Jedis.brpop(Jedis.java:1716)
at redis.clients.jedis.Jedis.brpop(Jedis.java:3400)
at com.ontheit.redis.clients.AbstractRedisClient.BRPOP(AbstractRedisClient.java:59)
at com.ontheit.redis.clients.AbstractRedisClient.BRPOP(AbstractRedisClient.java:50)
at com.ontheit.redis.clients.RedisRequestDaemonClient.getNotify(RedisRequestDaemonClient.java:147)
at com.ontheit.vertx.cache.CacheWorkVerticle.lambda$0(CacheWorkVerticle.java:27)
at com.ontheit.vertx.cache.CacheWorkVerticle$$Lambda$80/1754003563.handle(Unknown Source)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:273)
at io.vertx.core.impl.ContextImpl$$Lambda$85/1241209246.run(Unknown Source)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at io.vertx.core.impl.TaskQueue$$Lambda$9/1676010932.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Unknown Source)
we got this warning
we cant understand that warning came out with current circumstance.
we also can't understand why clients number is too high compare to real user who is using redis server.
how can we solved this?

Bluemix remote debugging session not starting

I have followed the Bluemix/Eclipse instructions to setup the Liberty servers in eclipse. Able to do everything with the Bluemix/eclipse tools except for remote debugging.
Receiving the following exceptions/errors when I select the "Enable Debug Mode" on my application under the servers.
Tried a longer Debug timeout but that has not helped. Any pointers?
TIA
[2015-11-30 07:16:56.832] bluemixMgmgClient - ???? [pool-1-thread-1]
.... ERROR --- ClientProxyImpl: Cannot create the websocket
connections for JavaMemcachedApp
com.ibm.ws.cloudoe.management.client.exception.ApplicationManagementException:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:161)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl$RunServerTask.run(ClientProxyImpl.java:267)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:315)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:158)
... 7 more Caused by: java.util.concurrent.TimeoutException at
org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:505)
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:542)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:296)
... 8 more [2015-11-30 07:17:56.868] bluemixMgmgClient - ????
[pool-1-thread-1] .... ERROR --- ClientProxyImpl: Cannot create the
websocket connections for JavaMemcachedApp
com.ibm.ws.cloudoe.management.client.exception.ApplicationManagementException:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:161)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl$RunServerTask.run(ClientProxyImpl.java:267)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:315)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:158)
... 7 more Caused by: java.util.concurrent.TimeoutException at
org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:505)
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:542)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:296)
... 8 more
You need to ensure that you've done the following:
Enabled & configured the debug App Management utility as indicated here (1).
Ensure that dev mode for Eclipse Tools is enabled as indicated here (2).
Enable Remote Debug in Eclipse Tools as indicate here (3).
(1) https://www.ng.bluemix.net/docs/manageapps/app_management.html#Utilities
(2) https://www.ng.bluemix.net/docs/manageapps/app_management.html#devmode
(3) https://www.ng.bluemix.net/docs/manageapps/eclipsetools/eclipsetools.html#remotedebug
Do you happens to be using IBM JDK to launch the workbench? There is an existing problem that we are tracking on the debug support using that combination. If you happens to be using that, can you try using an Orcale JDK 8 to see if that resolves the problem?
The issue was with the JDK in use .... replaced the ORACLE JDK 7 with ORACLE JRE 8 and that resolved the issue.
Regards
RS

Couldn't connect to the Box API due to a network error?

I am getting below mentioned error while accessing the box api using box java sdk in java application.Please suggest the cause for this problem.
Exception in thread "main" com.box.sdk.BoxAPIException: Couldn't connect to the Box API due to a network error.
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:386)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:200)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:175)
at com.box.sdk.BoxUser.getCurrentUser(BoxUser.java:112)
at com.box.cdm.demo.Main.main(Main.java:24)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:384)
... 4 more
The main causes of this exception - and the things you need to check - are:-
There is no network between your application (the client) and the server (the Box API). Where is the Box instance running, on same machine as your application (locally)?
What port is Box listening on? You need to show your connection code code (endpoint / port etc).
If client and server on different hardware, and you know you have a network connection between them then is Box behind firewall?

SoapUI: ConnectException: Connection timed out:

i try to send request via REST.
I get success response when using firefox rest-client,
but in SoapUI i get exception attached below.
How to resolve this issue?
Thanks.
java.net.ConnectException: Connection
timed out: connect at
java.net.PlainSocketImpl.socketConnect(Native
Method) at
java.net.PlainSocketImpl.doConnect(Unknown
Source) at
java.net.PlainSocketImpl.connectToAddress(Unknown
Source) at
java.net.PlainSocketImpl.connect(Unknown
Source) at
java.net.SocksSocketImpl.connect(Unknown
Source) at
java.net.Socket.connect(Unknown
Source) at
java.net.Socket.connect(Unknown
Source) at
java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown
Source) at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at
com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(SoapUIMultiThreadedHttpConnectionManager.java:1637)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:202)
at
com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at
java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at
java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at
java.util.concurrent.FutureTask.run(Unknown
Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source) at
java.lang.Thread.run(Unknown Source)
Default socket timeout is set to 60000 milliseconds.
You can change it:
File -> Preferences -> HTTP Settings -> Socket Timeout
You can also set the value to 0 and then it doesn't time out.
Tested it with SoapUI 4.5.0
You can also set timeout for your request, it's on left bottom Request properties, that helped me (SoapUI 5.4.0)
I would try adjusting the socket timeout in SoapUI preferences. SoapUI has a standard timeout of 60000 milliseconds. I would try making that much larger to see if you have the same issue. This has fixed a timeout issue for myself before.
You can also edit this setting directly in the soapui-settings.xml
<con:setting id="HttpSettings#socket_timeout">120000</con:setting>
If this doesn't help, try asking on the eviware forum.
Apart from adjusting timeouts, if this issue still persists then it could be because few of the plugins needed by SoapUI are not loaded. Because these plugins are present in some other place that require permission to access.
If u check your logs u can find this trace :
java.lang.ClassNotFoundException: com.eviware.soapui.plugins.auto.factories.AutoImportMethodFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
The problem does not occur when starting the SoapUI directly from bin
Also you can run with Administrative privileges.

Driver not found Exception in Web Service example

Hi
I am creating a web service and web service client in Eclipse IDE.
From the client I am able to access the methods of the web service, but when I write some code related to database( in the method of web service), I get Error that It is unable to locate the driver, But I have set the related jar file in the class path of the web service project.
After the above error I get the following Error:
[INFO] Unable to sendViaPost to url[http://localhost:5050/NewOracleMod1/services/Account.AccountHttpSoap11Endpoint/]
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at package1.AccountStub.updateAccount(AccountStub.java:202)
at package1.TestClient11.main(TestClient11.java:14)
org.apache.axis2.AxisFault: Connection refused: connect
I am new to Web services as well as to Eclipse IDE.
Please help me to come out of this problem.
Thanks
I need to put the jars in the lib of the project too. and the problem is solved