I had tried to trigger my Jenkins project by using this URL in my commit hook
curl http://jenkins_server/job/job_name/build?token=TOKEN
and is not getting triggered. But when i type this URL in my web browser, it triggers my build.
When i tried in my command prompt, I got an error
Error 404
Status Co
de: 404Exception:
Stacktrace: (none)
Generated by Winstone Servlet Engine v0.9.
10 at Tue Apr 22 16:57:38 CEST 2014
Can anybody tell me what i am doing wrong??
解决方案
First, as Electrawn suggested, verify that the server where the commit hook is running can actually reach Jenkins DNS. A simple ping or curl to the root address (i.e. http://jenkins_server) would suffice
Secondly, if your Jenkins does not allow anonymous read access and build triggering (and most installations won't) your issue is that your curl call is not logged in. In your browser, try logging out from Jenkins and then going to the same URL. Does that work? Probably not.
More succinct answer