Stronger security is required
To access this website, update your web browser or upgrade your operating system to support TLS 1.1 or TLS 1.2.
For more information, see Salesforce disabling TLS 1.0.
Closed Kxa422 closed 8 years ago
Hi @Kxa422 , are you still facing this issue?
Bug is not solved
Hi @Kxa422 , I'll be looking into this for you. Can you provide as much detail as you can on how you are running ApexUnit?
I'm making a git clone of https://github.com/forcedotcom/ApexUnit.git
After that, I'm running the following from Maven compile exec:java -Dexec.mainClass="com.sforce.cd.apexUnit.ApexUnitRunner" -Dexec.args=" -org.login.url https://na15.salesforce.com -org.username MyUser@MyDomain.com -org.password MyPasswordAndMySecurityToken -org.wide.code.coverage.threshold 75 -team.code.coverage.threshold 80 -org.client.id MyClientId -org.client.secret MyClientSecret -regex.for.selecting.test.classes.to.execute * -regex.for.selecting.source.classes.for.code.coverage.computation *"
It starting well like
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ApexUnit 2.3.4
[INFO] ------------------------------------------------------------------------
Close to the end the following appear
[com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.TestStatusPollerAndResultHandler - All tests have now completed executing!! [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitRunner - #################################### Computing code coverage for the team based on the Apex Class names(source class names) provided #################################### [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex(es): * to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex: "*" to fetch apex classes
And the problem appear
Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 02, 2016 7:36:09 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request [com.sforce.cd.apexUnit.ApexUnitRunner.main()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Exception during post method: java.net.BindException: Permission denied [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitUtils - Shutting down ApexUnit java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1365) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:68) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:53) at com.sforce.cd.apexUnit.client.codeCoverage.WebServiceInvoker.doPost(WebServiceInvoker.java:107) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:68) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:55) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:124) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:745)
Looks like this could potentially be an OAuth setting issue. Could you run this line (replacing the items in the line with your maven arguments) in your terminal and report back?
curl -v <Salesforce_Org_URL>/services/oauth2/token -d "grant_type=password" -d "client_id=***************************************" -d "client_secret= **************" -d "username=***********" -d "password= *******"
EDIT: The bolding is github's markdown and is not an emphasis
POST /services/oauth2/token HTTP/1.1 User-Agent: curl/7.30.0 Host: na15.salesforce.com Accept: / Content-Length: 222 Content-Type: application/x-www-form-urlencoded
Thanks, @Kxa422 . One thing that stands out to me is the "HTTP/1.1 400 Bad Request". Can you confirm that your credentials are setup correctly? Here is a guide that walks though the process.
Hello,
Credentials are working fine, if it was not the case the test cases were not submitted :-) That issue could be related to Java version, if I'm using Java 8 on a local computer it's working as expected, if I'm using a server (Can't update that one) with Java 7, the error appear.
@Kxa422 Interesting. I will continue looking into this and let you know when I find something.
@Kxa422 Does your password, username, or clientid happen to contain any special characters such as '#', "$', or '%'? We recently discovered that if a password contains special characters, the code computation part of the ApexUnit would fail and crash the program, while the test would run normally beforehand.
'#' is part of my password
@Kxa422 Ah, the bug with special characters may have played a role in your issue then. I have submitted a pull request for a fix and it should be merged before the end of the day. I'll let you know when that happens :)
@Kxa422 The fix for the password encoding issue has been merged! Please try pulling the latest version of this project and let me know if that resolves your issue :)
No, the issue is still there
@Kxa422 Interesting. Would you mind running this curl command again: curl -v (Salesforce_Org_URL here)/services/oauth2/token -d "grant_type=password" -d "clientid=**" -d "clientsecret= ***_" -d "username=_" -d "password= ******" But run it one time with your password as it is, and another time running your password after it has been encoded to the UTF-8 format? You can encode your password using this website: http://www.url-encode-decode.com/ which converts it to a text format that is compatible with a url. I'm curious to see if there are any differences between the two, specifically, whether they return your oauth token to you. Lastly, would you mind posting the console output of your apexunit run as well? Thanks!
From Curl
POST /services/oauth2/token HTTP/1.1 User-Agent: curl/7.30.0 Host: na15.salesforce.com Accept: / Content-Length: 226 Content-Type: application/x-www-form-urlencoded
<!DOCTYPE html>
Stronger security is requiredTo access this website, update your web browser or upgrade your operating system to support TLS 1.1 or TLS 1.2. For more information, see Salesforce disabling TLS 1.0. |
From the output
com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.connection.PartnerConnectionConnectorConfig - Updated connection time out value(from config.properties file): 1200000 [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex(es): * to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex: "*" to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.connection.ConnectionHandler - Bulk connection established. [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.AsyncBulkApiHandler - Creating batch for the test classes to execute using bulk connection.... [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.AsyncBulkApiHandler - Async test parent job Id : 707i000005TDSvRAAX [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.AsyncBulkApiHandler - ############################# List of Apex test classes successfully submitted to the Force.com test execution engine ############################# [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.TestExecutor - Parent job ID for the submission of the test classes to the Force.com platform is: 707i000005TDSvRAAX [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.TestExecutor - ############################# Now executing - Apex tests.. ############################# [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.TestStatusPollerAndResultHandler - Total test classes to execute: 83
And all test appear
[com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.testEngine.TestStatusPollerAndResultHandler - All tests have now completed executing!! [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitRunner - #################################### Computing code coverage for the team based on the Apex Class names(source class names) provided #################################### [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex(es): * to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex: "*" to fetch apex classes Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jul 15, 2016 2:23:08 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request [com.sforce.cd.apexUnit.ApexUnitRunner.main()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Exception during post method: java.net.BindException: Permission denied [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitUtils - Shutting down ApexUnit java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1329) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:68) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:53) at com.sforce.cd.apexUnit.client.codeCoverage.WebServiceInvoker.doPost(WebServiceInvoker.java:106) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:68) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:55) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:124) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:745)
@Kxa422 Great! Thanks for providing this info. So one fix that we have found for users that are running to the TLS issue is as you have deduced in a previous comment -- use Java 8. We recommend setting $JAVA_HOME to Java 8, and the TLS issue should be resolved. Just to be sure, you have pulled the latest version of this project, correct? One way to check is to see if in the pom.xml file, the version is now 2.3.5
@Kxa422 Have you had the chance to check if using Java 8 resolved the issue?
I've used a java 1.8 on the server, still the same issue. My guessing over here is that the code that is failing try to write in a folder without having permission to do so. When I'm using it on a Windows machine, it's working fine, when I'm on the server (Linux), it's failing.
@Kxa422 Interesting. Would you be able to modify the permissions of the folders on your server and let us know if that resolves the issue when you get the chance to? :)
@Kxa422 Would you like for us to setup a time for a google hangout so that we could get to the bottom of the issue in one go, hopefully?
At the end of the test process, the following error appear and no XML or HTML reports are created
Jun 22, 2016 2:33:21 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jun 22, 2016 2:33:22 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jun 22, 2016 2:33:22 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jun 22, 2016 2:33:22 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jun 22, 2016 2:33:22 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.BindException) caught when processing request: Permission denied Jun 22, 2016 2:33:22 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request [com.sforce.cd.apexUnit.ApexUnitRunner.main()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Exception during post method: java.net.BindException: Permission denied [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitUtils - Shutting down ApexUnit java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1365) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:68) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:53) at com.sforce.cd.apexUnit.client.codeCoverage.WebServiceInvoker.doPost(WebServiceInvoker.java:107) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:68) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:55) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:124) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:745)