NTLM Authentication with JMeter is receiving a SocketException - apache

I'm trying to load test a SSO request with JMeter (version 2.13). I followed this tutorial and set up an HTTP Authorization Manager with Username, Password, Domain and Mechanism = BASIC_DIGEST.
When I set the proxy server settings of my HTTP Request to Server Name or IP = 127.0.0.1 and Port Number = 8888, I can see my request go through fiddler where it gets two 401 responses and then succeeds. This shows up in the JMeter View Results Tree as a single successful request. However, when I remove the proxy server settings, the request fails and I get the following response:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:436)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
at java.lang.Thread.run(Unknown Source)
The log viewer also says this:
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$6: I/O exception (java.net.SocketException) caught when connecting to the target host: Connection reset
I have been trying all sorts of things to get this working without the proxy settings including using the HttpClient4 implementation, setting the following in user.properties
hc.parameters.file=hc.parameters
and the following in httpclient.parameters
http.protocol.reject-relative-redirect$Boolean=true
I will also note that when I run the test through Fiddler, I get a prompt asking if I want to ignore remote certificate errors
Session #106: The remote server (server name here) presented a certificate that did not validate, due to RemoteCertificateChainErrors.
0 - Unknown error.
I am assuming this won't make any difference in JMeter as I read that JMeter HTTP samplers are configured to accept all certificates.
Any help getting this up and running (without Fiddler) would be much appreciated.

The problem was that the Secure Credential Store I was trying to connect to required TLS version 1.0. I had to tell JMeter to use this by updating the jmeter.properties file with:
https.default.protocol=TLS
https.socket.protocols=TLSv1

Related

Getting jmeter error: java.net.UnknownHostException: This is usually a temporary error during hostname resolution

I am a beginner to jmeter. I am trying to perform a simple load test using jmeter 4.0. I created a HTTP sampler and added a view results tree listener.
HTTP Sampler
But getting the below error under Response data in results tree.
"java.net.UnknownHostException: This is usually a temporary error during hostname resolution and means that the local server did not
receive a response from an authoritative server at
java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at
java.net.InetAddress$2.lookupAllHostAddr(Unknown Source) at
java.net.InetAddress.getAddressesFromNameService(Unknown Source) at
java.net.InetAddress.getAllByName0(Unknown Source) at
java.net.InetAddress.getAllByName(Unknown Source) at
java.net.InetAddress.getAllByName(Unknown Source) at
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:263)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
at
org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:318)
at
org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:114)
at
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:697)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:455)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178)
at
org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490)
at
org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250)
at java.lang.Thread.run(Unknown Source)"
All requests are getting failed. There is no problem in internet connectivity. Please resolve my issue.
I just faced same issue. Found solution using below steps:
1.
Protocol:http/https
server name/IP:google.com
port & path:blank(as no params)
add proxy details if required

How to resolve the 400 The plain HTTP request was sent to HTTPS port issue in Apache Camel?

How to resolve the 400 The plain HTTP request was sent to HTTPS port issue?
from: empValidation
to: myhost:443/EmpValidation/EmpValidationAPIService
rules.getRules().forEach(x->{
final LoadBalanceDefinition lb = from("jetty:http://0.0.0.0:"+rules.getPort()+"/"+x.getFrom()+"??matchOnUriPrefix=true").log(LoggingLevel.DEBUG, "Processing ${id}").log("Incoming Context Request :"+x.getFrom())
.loadBalance().roundRobin();
x.getTo().forEach(z->lb.to("http4://"+z+"?bridgeEndpoint=true&throwExceptionOnFailure=true").log("Outgoing mapping urls :"+z)) ;
});
if i use "https4" component it's working the above url(empValidation) but it's not working for below url.
Url: myhost:9008/emp-web-service/services/addEmp
Error:
javax.net.ssl.SSLHandshakeException: Remote host closed connection during
handshake
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
I think if we use default port it's not working, what is solution for the above scenario?
Well, it depends if the endpoint is an http or https endpoint (with server certificate to encrypt the traffic between client and server). No matter under what port number it is published.
If the endpoint is https enabled, you need to use URIs like https4://hostname...
If the endpoint is a plain http endpoint, you you need to use URIs like http4://hostname...

Remote connection to Active-MQ Using JMX

I have a java application for monitoring the individual queues on Active MQ (version 5.13.0). The Objective of this application is to connect to the Active MQ broker and find out the in flight message count for specific queues. If the in flight message count is more than 50 then it sends an alert. This application performs this check every 10 minutes (Using Quartz Scheduler).
When I am connecting to the AMQ broker which uses the IP address to connect to the AMQ, I receive the IOException with the following stack trace -
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(Unknown Source)
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at com.globalcharge.quartz.job.CheckPendingConsumer.execute(CheckPendingConsumer.java:51)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
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 java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 12 more
I am using the following code to connect to the AMQ broker over JMX
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://192.168.11.72:1099/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url);
MBeanServerConnection conn = jmxc.getMBeanServerConnection();
ObjectName activeMq = new ObjectName("org.apache.activemq:Type=Broker,BrokerName=localhost");
BrokerViewMBean mbean = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(conn, activeMq, BrokerViewMBean.class, true);
//for each queue
for(ObjectName name : mbean.getQueues())
{
if(("dbg.notmanager.netsizeDelivery".equals(name)))
{
//obtain an instance of QueueViewMBean
QueueViewMBean queueMbean = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(conn, name, QueueViewMBean.class, true);
long inFlight = queueMbean.getInFlightCount();
if(inFlight >= 50)
{
sender.sendPassiveCriticalAlert(hostname, "Passive.GCDBG", "InFlight Messages for a consumer on " + name);
}
}
Notes:
1. If I install the AMQ on my local machine and deploy the code above on Tomcat running on my local machine it works. What I mean is, when both (Java Client and AMQ ) are on same machine, it works.
2. I have done the necessary configurations on AMQ server as mentioned here configure JMX for ActiveMQ for remoting access
3. I have checked the connectivity to IP and port mentioned in the code through telnet and it works.
4. I have also recorded the TCP dump on the AMQ server machine and I can see the request reaching there.
5. Both machines (where Tomcat and AMQ run) are not virtual machines, but are dedicated physical machines in the same network.
Please help :)
as logs say Connection refused, i think connection configs error.
you need these credentials too
JMXServiceURL url = ...;
Map env = ...;
String[] creds = {"admin", "activemq"};
env.put(JMXConnector.CREDENTIALS, creds);
JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
I am able to connect now using the JConsole as well as the Java Code I have written. The Problem was in the env file (under amqHome/bin/) had a property java.rmi.server.hostname which had a value 127.0.0.1
I changed this value to 192.168.11.72 (the IP of the machine) and it worked ....
Thanks all for the support ....

IBM Worklight 6.2.0.01 HTTP Adapter failed to read xml from web site with HTTPS

I have a http adapter which retrieves a XML file from a website through HTTPS. The SSL certificate is a real and valid certificate, not self-signed one. It used to be fine and working for over a year.
I recently upgraded to Worklight 6.2.0.01.20150129-1911 and the adapter now failed.
The error from Worklight Server is as below:
FWLSE0101E: Caused by: [project MobileApp5062]javax.net.ssl.SSLPeerUnverifiedException: peer not authenticatedjava.lang.RuntimeException: Http request failed: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at com.worklight.adapters.http.HTTPConnectionManager.execute(HTTPConnectionManager.java:233)
at com.worklight.adapters.http.HttpClientContext.doExecute(HttpClientContext.java:185)
at com.worklight.adapters.http.HttpClientContext.execute(HttpClientContext.java:169)
at com.worklight.adapters.http.HTTP.execRequest(HTTP.java:148)
at com.worklight.adapters.http.HTTP.invoke(HTTP.java:137)
at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:57)
at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:169)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:38)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.worklight.integration.model.InvocationContext$DirectExecutorService.execute(InvocationContext.java:284)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at com.worklight.integration.model.InvocationContext.submit(InvocationContext.java:138)
at com.worklight.integration.model.InvocationContextManager.submitInvocation(InvocationContextManager.java:58)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:522)
at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:61)
at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:417)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:414)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeDynamicProcedure(DataAccessServiceImpl.java:481)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeDynamicProcedureWithEnclosingProcedureProperties(DataAccessServiceImpl.java:465)
at com.worklight.integration.js.JavaScriptIntegrationLibraryImplementation.invokeDynamicProcedureWithEnclosingProcedureProperties(JavaScriptIntegrationLibraryImplementation.java:142)
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.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen._integration_js_12._c_anonymous_10(/integration.js:95)
at org.mozilla.javascript.gen._integration_js_12.call(/integration.js)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
at org.mozilla.javascript.gen.RateAdapter_impl_js_20._c_getRateData_3(RateAdapter-impl.js:66)
at org.mozilla.javascript.gen.RateAdapter_impl_js_20.call(RateAdapter-impl.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.gen.RateAdapter_impl_js_20.call(RateAdapter-impl.js)
at com.worklight.integration.js.JavaScriptManager.callFunction(JavaScriptManager.java:240)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:214)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:194)
at com.worklight.integration.services.impl.AdapterManagerImpl.invokeFunction(AdapterManagerImpl.java:117)
at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:42)
at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:57)
at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:169)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:38)
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 com.worklight.server.util.ProjectLocal$1RunnableWrapper.run(ProjectLocal.java:261)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at com.worklight.adapters.http.HTTPConnectionManager.execute(HTTPConnectionManager.java:231)
... 50 more
I've tested the adapter with two different hosts, one having a valid SSL cert issued by VeriSign (IIS) and another host having a valid SSL cert issued by Starcom (Apache). Both failed.
Supplement accordingly to Idan's comment
The issued happened on both local development environment with worklight studio and UAT server, both running same WL server version.
Web server and worklight server are hosted on different server. Not on same machine.
You do not explain in the question how was the certificate set-up on the server side. It could be that the certificate configuration was set to expire after 365 days (1 year).
The following are Worklight 6.2 user documentation topics that you should read through thoroughly and then see if you need to adjust your certificate set-up:
SSL configuration
SSL certificate keystore setup
Configuring SSL between Worklight adapters and back-end servers (note the example with setting up validity days)

Connection failing with pop3 using java mail api to Exchange server

I am facing issue, connecting clients Exchange server via JAVAMAIL api using pop3. It works fine with gmail. Please look into this, if is something familiar.
Following exception we get while trying to connect on client's Exchange server
javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connecti
on?
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
at javax.mail.Service.connect(Service.java:295)
at TestPOP3Connection.run(TestPOP3Connection.java:23)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext conne
ction?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown
Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Un
known Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Sou
rce)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Sou
rce)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java
:507)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:107)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
... 2 more
Thanks in advance
Rohit
You're trying to connect using SSL, but you're connecting to a port that doesn't support SSL.
Gmail requires SSL, so your program is probably set up to do that, but then when changing to use your Exchange server you probably changed the host name and set the port number to 110. The SSL port number for POP3 is 995. Of course, make sure your Exchange server is configured to accept SSL requests on that port.