JMeter Learning -017-java.net.socketexception:permission Denied:connect Solutions

Source: Internet
Author: User

A few days ago, with the new interface performance testing requirements, a colleague after adding an HTTP request, the runtime response information is as follows:

 1 java.net.SocketException:Permission denied:connect 2 at Java.net.DualStackPlainSocketImpl.connect0 (Native Method) 3 at Java.net.DualStackPlainSocketImpl.socketConnect (dualstackplainsocketimpl.java:79) 4 at Java.net.AbstractPlai Nsocketimpl.doconnect (abstractplainsocketimpl.java:345) 5 at Java.net.AbstractPlainSocketImpl.connectToAddress ( abstractplainsocketimpl.java:206) 6 at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:188) 7 at Java.net.PlainSocketImpl.connect (plainsocketimpl.java:172) 8 at Java.net.SocksSocketImpl.connect (Sockssocketi mpl.java:392) 9 at Java.net.Socket.connect (socket.java:589) at org.apache.http.conn.scheme.PlainSocketFactory.co Nnectsocket (plainsocketfactory.java:127) at Org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection (Defaultclientconnectionoperator.java : + at Org.apache.http.impl.conn.ManagedClientConnectionImpl.open (managedclientconnectionimpl.java:294) 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:505) at Org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample (httphc4impl.java:328) at Org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample (httpsamplerproxy.java:74) at Org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample (httpsamplerbase.java:1141) at Org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample (httpsamplerbase.java:1130) at Org.apache.jmeter.threads.JMeterThread.process_sampler (jmeterthread.java:431) at Org.apache.jmeter.threads.JMeterThreAd.run (jmeterthread.java:258) at Java.lang.Thread.run (thread.java:745) 

After inquiry gu Big Ye, looked up, found that as long as in the startup script to add -Djava.net.preferIPv4Stack=true parameters, set their network preferences to IPV4. The settings are as follows:

Boot configuration file path: {JMeter home directory}\bin

Linux Boot configuration file: jmeter.sh, add the following startup parameter settings:
Export jvm_args= "-djava.net.preferipv4stack=true"

Winows startup configuration file: Jmeter.bat, add the following startup parameter settings:
Set jvm_args= "-djava.net.preferipv4stack=true"

Restart JMeter to run the script to resolve the previous error.

Postscript:

After solving the problem, as a full-time tester, I asked myself if I was developing a IPv4 preference for this interface. Think about it. To prevent the user from accessing the above interface, I'll go to the appropriate interface developer to confirm it. After confirming that it does not make the corresponding settings, while viewing the source traversal IPv information, also did not find the corresponding settings!

The new problem arises, what caused its access to the interface, when the preference of IPv4????

Just so-called, Kung Fu is not a conscientious! After the effort, query the Networking Properties of the JDK to get the final answer, as shown below.

Later, JMeter's user manual was queried, and it was found that it could be ported to any system by modifying its configuration file, without the need to change the corresponding boot file for each system.

System configuration file: {JMeter home directory}\bin\system.properties, set Java.net.preferIPv4Stack to True

JMeter Learning -017-java.net.socketexception:permission Denied:connect Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.