"Page expects a form submission" error when trying to remotely trigger job

4,424 views
Skip to first unread message

Substance586

unread,
Mar 9, 2017, 12:18:14 PM3/9/17
to Jenkins Users
I'm trying to trigger a Jenkins job from my local CLI and, while it worked yesterday, today I can't get past "javax.servlet.ServletException: This page expects a form submission but had only {token=[Ljava.lang.String;@xxxx} exceptions.  Here is my CLI command:

curl -v -X POST http://<server>/jenkins/job/<jobName>/build?token=12345

I've seen numerous ways to trigger builds remotely and the way that I've chosen is to set the token above in the destination job's "Trigger builds remotely" section and use the preceding curl command.  I'm open to better ways to accomplish this.  

Stack Trace:
* Connected to <server> (10.34.184.89) port 80 (#0)
> POST /<jobName>/build?token=12345 HTTP/1.1
> Host: <server>
> User-Agent: curl/7.43.0
> Accept: */*
< HTTP/1.1 500 Internal Server Error
< Date: Thu, 09 Mar 2017 17:05:56 GMT
< Pragma: no-cache
< Cache-Control: max-age=0, public
< X-Content-Type-Options: nosniff
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 5970
< Connection: close
<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.36 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 500 - This page expects a form submission but had only {token=[Ljava.lang.String;@xxxxx}</h1><div class="line"></div><p><b>type</b> Exception report</p><p><b>message</b> <u>This page expects a form submission but had only {token=[Ljava.lang.String;@xxxxx}</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b></p><pre>javax.servlet.ServletException: This page expects a form submission but had only {token=[Ljava.lang.String;@xxxxx}
        org.kohsuke.stapler.RequestImpl.getSubmittedForm(RequestImpl.java:1007)
        hudson.model.ParametersDefinitionProperty._doBuild(ParametersDefinitionProperty.java:155)
        jenkins.model.ParameterizedJobMixIn.doBuild(ParameterizedJobMixIn.java:195)
        hudson.model.AbstractProject.doBuild(AbstractProject.java:1745)
        hudson.model.AbstractProject.doBuild(AbstractProject.java:1751)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:606)
        org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324)
        org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)
        org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)
        org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124)
        org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
        org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
        org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
        org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
        org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
        org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
        org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
        org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
        org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
        org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
        org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
        org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
        org.kohsuke.stapler.Stapler.service(Stapler.java:238)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
        com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
        jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
        hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
        org.jenkinsci.plugins.modernstatus.ModernStatusFilter.doFilter(ModernStatusFilter.java:52)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
        hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:95)
        hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
        hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
        hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
        hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
        hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
        hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
        hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
        hudson.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:100)
* Closing connection 0
</pre><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/8.0.36 logs.</u></p><hr class="line"><h3>Apache Tomcat/8.0.36</h3></body></html>

Christopher Orr

unread,
Mar 10, 2017, 10:10:58 PM3/10/17
to jenkins...@googlegroups.com
On Thu, 9 Mar 2017, at 18:18, Substance586 wrote:
> I'm trying to trigger a Jenkins job from my local CLI and, while it
> worked
> yesterday, today I can't get past "javax.servlet.ServletException: This
> page expects a form submission but had only
> {token=[Ljava.lang.String;@xxxx} exceptions. Here is my CLI command:
>
> curl -v -X POST http://<server>/jenkins/job/<jobName>/build?token=12345
>
> I've seen numerous ways to trigger builds remotely and the way that I've
> chosen is to set the token above in the destination job's "Trigger builds
> remotely" section and use the preceding curl command. I'm open to better
> ways to accomplish this.
>
> Stack Trace:
> * Connected to <server> (10.34.184.89) port 80 (#0)
> > POST /<jobName>/build?token=12345 HTTP/1.1
> > Host: <server>
> > User-Agent: curl/7.43.0
> > Accept: */*

Your curl command says /jenkins/job/<jobName>, but your curl output has
only /<jobName> as the path prefix?
You also don't need to use POST for this endpoint.

Using the CLI is a good way to start a build, and doesn't require a
token:
https://jenkins.io/doc/book/managing/cli/#build
Reply all
Reply to author
Forward
0 new messages