forcedotcom / ApexUnit

ApexUnit is a powerful continuous integration tool for the Force.com platform
BSD 3-Clause "New" or "Revised" License
71 stars 51 forks source link

Connection Problem #76

Closed CompositionBooks closed 5 years ago

CompositionBooks commented 5 years ago

[INFO] Scanning for projects... [WARNING] The project com.sforce.cd.ApexUnit:ApexUnit-core:jar:2.3.6 uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html [INFO] [INFO] ----------------< com.sforce.cd.ApexUnit:ApexUnit-core >---------------- [INFO] Building ApexUnit 2.3.6 [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2 [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ApexUnit-core --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 7 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ApexUnit-core --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 28 source files to C:\Program Files (x86)\Jenkins\workspace\Test\target\classes [WARNING] /C:/Program Files (x86)/Jenkins/workspace/Test/src/main/java/com/sforce/cd/apexUnit/client/codeCoverage/WebServiceInvoker.java: C:\Program Files (x86)\Jenkins\workspace\Test\src\main\java\com\sforce\cd\apexUnit\client\codeCoverage\WebServiceInvoker.java uses unchecked or unsafe operations. [WARNING] /C:/Program Files (x86)/Jenkins/workspace/Test/src/main/java/com/sforce/cd/apexUnit/client/codeCoverage/WebServiceInvoker.java: Recompile with -Xlint:unchecked for details. [INFO] [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ ApexUnit-core >>> [INFO] [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ ApexUnit-core <<< [INFO] [INFO] [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ ApexUnit-core --- [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitRunner - #################################### Processing the Apex test classes specified by the user #################################### [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.connection.PartnerConnectionConnectorConfig - Default connection time out value is: 0 [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()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Connection Exception encountered The connection exception description says : null Object dump for the Connection object: [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:1336) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:48) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:33) at com.sforce.cd.apexUnit.client.connection.ConnectionHandler.createConnection(ConnectionHandler.java:113) at com.sforce.cd.apexUnit.client.connection.ConnectionHandler.getConnection(ConnectionHandler.java:164) at com.sforce.cd.apexUnit.client.testEngine.TestExecutor.testExecutionFlow(TestExecutor.java:42) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:74) 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:748) Sending e-mails to: xxxxxx@xxxx.com Finished: SUCCESS

CompositionBooks commented 5 years ago

Here is full Console Output

Started by user pawan Building in workspace C:\Program Files (x86)\Jenkins\workspace\Test

git.exe rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository git.exe config remote.origin.url https://github.com/xxxxxxxxxxxx/ApexUnit.git # timeout=10 Fetching upstream changes from https://github.com/xxxxxxxxxxxx/ApexUnit.git git.exe --version # timeout=10 git.exe fetch --tags --progress https://github.com/xxxxxxxxxxxx/ApexUnit.git +refs/heads/:refs/remotes/origin/ git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 Checking out Revision 2402f2e2851eb589170a895276f5c02dc8c85bbd (refs/remotes/origin/master) git.exe config core.sparsecheckout # timeout=10 git.exe checkout -f 2402f2e2851eb589170a895276f5c02dc8c85bbd Commit message: "Changed Classed for New org" git.exe rev-list --no-walk 2402f2e2851eb589170a895276f5c02dc8c85bbd # timeout=10 [Test] $ cmd.exe /C "mvn compile exec:java -Dexec.mainClass=com.sforce.cd.apexUnit.ApexUnitRunner '"-Dexec.args=-org.login.url https://xxxxxxxxxx-xxx-xx.my.salesforce.com -org.username xxxxxxxxxx@salesforce.com -org.password xxxxxxxxx -org.wide.code.coverage.threshold 10 -team.code.coverage.threshold 10 -org.client.id 3MVG9dZJodJWITSsXdR44g7e4o8oFa.iSLwlcwJgazpkswxFdk_aZwz_6Ne9giOGO8a4PCStDPCwKZyqIymPC -org.client.secret 4005301373875135523 -manifest.files.with.test.class.names.to.execute ManifestFile_For_Unit_Test_Classes.txt -manifest.files.with.source.class.names.for.code.coverage.computation ClassManifestFile.txt -max.test.execution.time.threshold 10"' && exit %%ERRORLEVEL%%" [INFO] Scanning for projects... [WARNING] The project com.sforce.cd.ApexUnit:ApexUnit-core:jar:2.3.6 uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html [INFO] [INFO] ----------------< com.sforce.cd.ApexUnit:ApexUnit-core >---------------- [INFO] Building ApexUnit 2.3.6 [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2 [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ApexUnit-core --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 7 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ApexUnit-core --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 28 source files to C:\Program Files (x86)\Jenkins\workspace\Test\target\classes [WARNING] /C:/Program Files (x86)/Jenkins/workspace/Test/src/main/java/com/sforce/cd/apexUnit/client/codeCoverage/WebServiceInvoker.java: C:\Program Files (x86)\Jenkins\workspace\Test\src\main\java\com\sforce\cd\apexUnit\client\codeCoverage\WebServiceInvoker.java uses unchecked or unsafe operations. [WARNING] /C:/Program Files (x86)/Jenkins/workspace/Test/src/main/java/com/sforce/cd/apexUnit/client/codeCoverage/WebServiceInvoker.java: Recompile with -Xlint:unchecked for details. [INFO] [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ ApexUnit-core >>> [INFO] [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ ApexUnit-core <<< [INFO] [INFO] [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ ApexUnit-core --- [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitRunner - #################################### Processing the Apex test classes specified by the user #################################### [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.connection.PartnerConnectionConnectorConfig - Default connection time out value is: 0 [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()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Connection Exception encountered The connection exception description says : null Object dump for the Connection object: [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:1336) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:48) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:33) at com.sforce.cd.apexUnit.client.connection.ConnectionHandler.createConnection(ConnectionHandler.java:113) at com.sforce.cd.apexUnit.client.connection.ConnectionHandler.getConnection(ConnectionHandler.java:164) at com.sforce.cd.apexUnit.client.testEngine.TestExecutor.testExecutionFlow(TestExecutor.java:42) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:74) 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:748) Finished: SUCCESS

CompositionBooks commented 5 years ago

Ok so i had Security Token issue, so I added my ip in network access in salesforce to bypass security token. still there is problem regarding security token.. here is debug log


[com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer - Fetching apex classes from location : ClassManifestFile.txt [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.fileReader.ApexManifestFileReader - Reading from Manifest files: ClassManifestFile.txt [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.fileReader.ApexManifestFileReader - Reading Manifest file from location : ClassManifestFile.txt [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.fileReader.ApexManifestFileReader - Input stream: java.io.BufferedInputStream@13415f90 [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.fileReader.ApexManifestFileReader - The line says .... - WrapperExampleController [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched Apex classes: [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - ApexClassId : 01p1U000006X9JsQAK ApexClassName : WrapperExampleController [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.fileReader.ApexManifestFileReader - tempTestClassId: 01p1U000006X9JsQAK [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched apex classes: [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - WrapperExampleController [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched apex classes: [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - WrapperExampleController [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched Apex test classes from the manifest file(s):ClassManifestFile.txt [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched apex classes: [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - WrapperExampleController Dec 12, 2018 3:11:28 PM org.apache.commons.httpclient.HttpMethodBase getResponseBody WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended. [com.sforce.cd.apexUnit.ApexUnitRunner.main()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Unable to get access_token for OAuth authentication and hence unable to establish connection with the web services.Terminating the process.. [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:1336) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:48) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:54) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:36) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:175) 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:748) Finished: SUCCESS

CompositionBooks commented 5 years ago

log.zip here is log file i've attached.

CompositionBooks commented 5 years ago

Ok I have resolve this issue with help of this Knowledge Article in salesforce.

'Failed: Not approved for access' error

Knowledge Article Number 000212208

After entering credentials and attempting to login to Salesforce, the API user is denied access to the application and is typically accompanied by a Login History Status of "Failed: Not approved for access". This issue is caused when a Connected App is created but the API user is not authorized to access. Follow these steps to resolve this: Navigate to the Connected App Detail (Setup | Manage Apps | Connected Apps) for the appropriate Connected App, and under the OAuth policies section, Permitted Users is (most likely) set to "Admin approved users are pre-authorized".1.  To allow access to this app for a particular group of users:Leverage "Manage Profiles" and the Profiles related list to authorize access to the appropriate Salesforce profiles (and associated users).Alternatively, Leverage Permission Sets and the Permission Sets related list to authorize access at a more granular level.2.  To allow access to this App for all users: Under the OAuth policies section, set Permitted Users to "All users may self-authorize".

CompositionBooks commented 5 years ago

Issue is resolved.