mbockus / veracode-scanner

A jenkins plug-in for submitting files for scanning to veracode.
4 stars 17 forks source link

Connection timed out #7

Closed raditp closed 10 years ago

raditp commented 10 years ago

When I’m trying to upload file using the Veracode plug-in, the following error occurred:

Connection timed out: connect java.net.ConnectException: Connection timed out: connect FATAL: java.net.ConnectException: Connection timed out: connect org.jenkinsci.plugins.veracodescanner.exception.VeracodeScannerException: java.net.ConnectException: Connection timed out: connect at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.getAppId(VeracodeNotifier.java:230) at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.performScan(VeracodeNotifier.java:143) at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.perform(VeracodeNotifier.java:87) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:781) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753) ….

Proxy is already set in Jenkins. And I'm able to login to veracode site via browser. Is there any additional setting required?

mbockus commented 10 years ago

Are you still experiencing this issue? Are you accessing veracode using a browser on the same system that Jenkins is hosted on? I can't think of any configuration options that would prevent a connection to veracode, so there's probably a network setting preventing the connection somewhere between your Jenkins server and the Veracode server. I'm hopeful that the issue was temporary due to some Veracode maintenance or something similar... :)

raditp commented 10 years ago

It seems like the plugin can't use proxy setting from Jenkins. So I tried setting proxy to jvm by modifying arguments in jenkins.xml file (I have installed Jenkins as windows service). And it can get the AppId.

something like this:

java -Dhttps.proxyHost=url -Dhttps.proxyPort=portnumber -Xrs -Xmx256m ....

But after that, there's another error occurred. Veracode scan failed. FATAL: Veracode scan failed. org.jenkinsci.plugins.veracodescanner.exception.VeracodeScannerException: Veracode scan failed. at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.performScan(VeracodeNotifier.java:169) at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.perform(VeracodeNotifier.java:87) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:781) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753) at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) at hudson.model.Run.execute(Run.java:1724) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230) Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://analysiscenter.veracode.com/api/4.0/uploadfile.do at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at com.veracode.util.http.ClientHttpRequest.doPost(ClientHttpRequest.java:449) at com.veracode.util.http.ClientHttpRequest.post(ClientHttpRequest.java:480) at com.veracode.util.http.ClientHttpRequest.post(ClientHttpRequest.java:585) at com.veracode.util.http.WebClient.consumeResponse(WebClient.java:140) at com.veracode.util.http.WebClient.uploadFile(WebClient.java:35) at com.veracode.apiwrapper.wrappers.UploadAPIWrapper.uploadFile(UploadAPIWrapper.java:1151) at org.jenkinsci.plugins.veracodescanner.VeracodeNotifier.performScan(VeracodeNotifier.java:152) ... 9 more

mbockus commented 10 years ago

I haven't tried using a proxy, so I'm not sure if there's an issue with Veracode's client API that would prevent it from working with a proxy config for some reason. I was also experiencing 401 responses from Veracode only with certain API calls, but I haven't been able to reproduce lately so I haven't confirmed whether it's a server side issue or an issue with the client side API.

Have you tried the plugin supported by Veracode to see if it works in your Jenkins environment? Veracode has a plugin that they support, but it's only available via manual upload. You can download the plug-in from here. Try that out if you can and let me know if you get the same results.

raditp commented 10 years ago

Yes, I have tried the official plugin. After setting proxy to jvm in jenkins.xml (as described above), it works fine with no more errors.

mbockus commented 10 years ago

Great, glad you got it working!

edbrannin commented 7 years ago

I'm getting this error too -- it's great that there's a workaround, but it would be better if the plugin could use the Jenkins-configured proxy settings.

tpilli-zz commented 5 years ago

I'm getting this error when I try to upload from java application. Do I need to use java API wrappers?

msrinivascharan commented 3 years ago

Faced same issue with Azure DevOps Veracode extension to upload and scan, fixed the issue by setting proxy to JVM via arguments (-phost xyzproxy.com -pport 1243) option in the extension. it worked for me.