January 28, 2014

Authentication Token is required to trigger the Jenkins Jobs Remotely

This article focuses on triggering the Jenkins Job remotely in 1.499 and the issue faced when upgraded to 1.546.

With Jenkins 1.499, GET method was used to invoke the URL http://JenkinsURL/job/JOBNAME/buildWithParameters?param1=value1&param2=value2

With the latest version of Jenkins (say 1.546), the trouble started while triggering the Jenkins jobs remotely as Jenkins is looking for POST rather than GET method and giving below error message,


Further research fetched some light through the below  URL that an authentication token that needs to be passed to the Jenkins job as shown in the below screen shot and it has helped to resolve the issue.


 
So the updated URL with Authentication Token for POST method is  http://JenkinsURL/job/JOBNAME/buildWithParameters?param1=value1&param2=value2&token=build

January 15, 2014

Multijob Plugin throws NoClassDefFoundError without Parameter Plugin

If you install a multi-job plugin 1.7 on Jenkins 1.499 without Parameter plugin, you will get NoClassDefFoundError (as mentioned below), while creating a multi-job and saving it.

So while installing any plugin, make sure to install all the required dependant plugins.

Status Code: 500

Exception: java.lang.NoClassDefFoundError: hudson/plugins/parameterizedtrigger/AbstractBuildParameters$DontTriggerException
Stacktrace:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: hudson/plugins/parameterizedtrigger/AbstractBuildParameters$DontTriggerException

        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:615)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658)
        at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:487)
        at org.kohsuke.stapler.Stapler.service(Stapler.java:164)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
        at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
        at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
        at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:98)
        at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
        at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
        at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
        at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
        at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
        at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
        at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
        at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
        at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
        at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
        at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
        at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
        at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
        at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:215)
        at winstone.RequestHandlerThread.run(RequestHandlerThread.java:138)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: hudson/plugins/parameterizedtrigger/AbstractBuildParameters$DontTriggerException
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Unknown Source)
        at java.lang.Class.privateGetPublicFields(Unknown Source)
        at java.lang.Class.getFields(Unknown Source)
        at org.kohsuke.stapler.ClassDescriptor.<init>(ClassDescriptor.java:71)
        at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:561)
        at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:618)
        at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:377)
        at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:574)
        at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:377)
        at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:373)
        at com.tikal.jenkins.plugins.multijob.MultiJobBuilder$DescriptorImpl.newInstance(MultiJobBuilder.java:231)
        at com.tikal.jenkins.plugins.multijob.MultiJobBuilder$DescriptorImpl.newInstance(MultiJobBuilder.java:214)
        at hudson.model.Descriptor.newInstancesFromHeteroList(Descriptor.java:939)
        at hudson.model.Descriptor.newInstancesFromHeteroList(Descriptor.java:926)
        at hudson.util.DescribableList.rebuildHetero(DescribableList.java:203)
        at hudson.model.Project.submit(Project.java:200)
        at hudson.model.Job.doConfigSubmit(Job.java:1046)
        at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:723)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
        at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:151)
        at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:90)
        at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:111)
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573)
        ... 41 more

Caused by: java.lang.ClassNotFoundException: hudson.plugins.parameterizedtrigger.AbstractBuildParameters$DontTriggerException
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 70 more

Related Article: Multijob Plugin Null Pointer Exception.