Debugging HtmlUnit: FailingHttpStatusCodeException 500 Server Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging HtmlUnit: FailingHttpStatusCodeException 500 Server Error

Alexandra Goultiaeva
I am working on Jenkins Unit tests, and am trying to add a round trip test.
Unfortunately, I keep getting errors.


I've added the roundtrip test ClassicUploadStepTest
When I run the test, I get the following error:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for http://localhost:33657/jenkins/job/test0/configure

I've played with the test a bit, and found that if I comment out my setUp, the test works. It seems that the test breaks as soon as I add the following line:
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
I'm somewhat at a loss as to how to debug this further.
Stack traces seem to point to where the exception is thrown (throwFailingHttpStatusCodeExceptionIfNecessary), and not where the error occurred. The error itself is quite generic.

Any hints on how to approach this?
How can I try to get at the root cause for the 500?

Thanks!


PS. This is the stack trace I'm getting:
testRoundtrip(com.google.jenkins.plugins.storage.ClassicUploadStepTest)  Time elapsed: 6.1 sec  <<< ERROR!
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for http://localhost:37367/jenkins/job/test0/configure
at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:535)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2148)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2128)
at org.jvnet.hudson.test.JenkinsRule$WebClient.getPage(JenkinsRule.java:2084)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1077)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1087)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.ConfigurationRoundTripTest(ClassicUploadStepTest.java:82)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.testRoundtrip(ClassicUploadStepTest.java:89)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Debugging HtmlUnit: FailingHttpStatusCodeException 500 Server Error

Robert Sandell-2
A 500 server error is an indication that an exception was thrown in the backend when the http request was made.
You should see another stacktrace in the log just before the FailingHttpstatusCodeException.

/B

2017-09-27 22:53 GMT+02:00 'Alexandra Goultiaeva' via Jenkins Developers <[hidden email]>:
I am working on Jenkins Unit tests, and am trying to add a round trip test.
Unfortunately, I keep getting errors.


I've added the roundtrip test ClassicUploadStepTest
When I run the test, I get the following error:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for http://localhost:33657/jenkins/job/test0/configure

I've played with the test a bit, and found that if I comment out my setUp, the test works. It seems that the test breaks as soon as I add the following line:
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
I'm somewhat at a loss as to how to debug this further.
Stack traces seem to point to where the exception is thrown (throwFailingHttpStatusCodeExceptionIfNecessary), and not where the error occurred. The error itself is quite generic.

Any hints on how to approach this?
How can I try to get at the root cause for the 500?

Thanks!


PS. This is the stack trace I'm getting:
testRoundtrip(com.google.jenkins.plugins.storage.ClassicUploadStepTest)  Time elapsed: 6.1 sec  <<< ERROR!
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for http://localhost:37367/jenkins/job/test0/configure
at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:535)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2148)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2128)
at org.jvnet.hudson.test.JenkinsRule$WebClient.getPage(JenkinsRule.java:2084)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1077)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1087)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.ConfigurationRoundTripTest(ClassicUploadStepTest.java:82)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.testRoundtrip(ClassicUploadStepTest.java:89)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3m_LNj59pEJeDCJGO4-Org2M2H_%2BL4qf0qGKds9-46OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Debugging HtmlUnit: FailingHttpStatusCodeException 500 Server Error

Alexandra Goultiaeva
Ooh, right, thanks!

In case there will be another newbie reading this:
The output from "mvn package" contains the last exception thrown, but it's not the whole log!

Running the individual test gave the full log:
mvn test -Dtest=com.google.jenkins.plugins.storage.ClassicUploadStepTest

In my case I haven't mocked out getDescriptor(), so it returns nullptr and the server dies with NullPointerException

Thanks for getting me on track again!



On Thursday, September 28, 2017 at 5:11:36 AM UTC-4, Robert Sandell wrote:
A 500 server error is an indication that an exception was thrown in the backend when the http request was made.
You should see another stacktrace in the log just before the FailingHttpstatusCodeException.

/B

2017-09-27 22:53 GMT+02:00 'Alexandra Goultiaeva' via Jenkins Developers <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="bYDtwx0-BwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkin...@googlegroups.com>:
I am working on Jenkins Unit tests, and am trying to add a <a href="https://wiki.jenkins.io/display/JENKINS/Unit+Test#UnitTest-Configurationround-triptesting" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins.io%2Fdisplay%2FJENKINS%2FUnit%2BTest%23UnitTest-Configurationround-triptesting\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFkndgXFgt2WSuI-POLgs05QxHmMQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins.io%2Fdisplay%2FJENKINS%2FUnit%2BTest%23UnitTest-Configurationround-triptesting\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFkndgXFgt2WSuI-POLgs05QxHmMQ&#39;;return true;">round trip test.
Unfortunately, I keep getting errors.

Here is a <a href="https://github.com/agoulti/google-storage-plugin/tree/brokenUnitTest" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fagoulti%2Fgoogle-storage-plugin%2Ftree%2FbrokenUnitTest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5gyjGlB6NECbwVp5XqYj6-Qp8DQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fagoulti%2Fgoogle-storage-plugin%2Ftree%2FbrokenUnitTest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5gyjGlB6NECbwVp5XqYj6-Qp8DQ&#39;;return true;">branch with my (broken) changes.

I've added the roundtrip test <a href="https://github.com/agoulti/google-storage-plugin/blob/brokenUnitTest/src/test/java/com/google/jenkins/plugins/storage/ClassicUploadStepTest.java" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fagoulti%2Fgoogle-storage-plugin%2Fblob%2FbrokenUnitTest%2Fsrc%2Ftest%2Fjava%2Fcom%2Fgoogle%2Fjenkins%2Fplugins%2Fstorage%2FClassicUploadStepTest.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFKVoplllZJphQTNlmJ9OrxnOE72g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fagoulti%2Fgoogle-storage-plugin%2Fblob%2FbrokenUnitTest%2Fsrc%2Ftest%2Fjava%2Fcom%2Fgoogle%2Fjenkins%2Fplugins%2Fstorage%2FClassicUploadStepTest.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFKVoplllZJphQTNlmJ9OrxnOE72g&#39;;return true;">ClassicUploadStepTest
When I run the test, I get the following error:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for <a href="http://localhost:33657/jenkins/job/test0/configure" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A33657%2Fjenkins%2Fjob%2Ftest0%2Fconfigure\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG2e5cQ9jiScq3mjxO2QbYfWkDEAw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A33657%2Fjenkins%2Fjob%2Ftest0%2Fconfigure\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG2e5cQ9jiScq3mjxO2QbYfWkDEAw&#39;;return true;">http://localhost:33657/jenkins/job/test0/configure

I've played with the test a bit, and found that if I comment out my setUp, the test works. It seems that the test breaks as soon as I add the following line:
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
I'm somewhat at a loss as to how to debug this further.
Stack traces seem to point to where the exception is thrown (throwFailingHttpStatusCodeExceptionIfNecessary), and not where the error occurred. The error itself is quite generic.

Any hints on how to approach this?
How can I try to get at the root cause for the 500?

Thanks!


PS. This is the stack trace I'm getting:
testRoundtrip(com.google.jenkins.plugins.storage.ClassicUploadStepTest)  Time elapsed: 6.1 sec  <<< ERROR!
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server Error for <a href="http://localhost:37367/jenkins/job/test0/configure" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A37367%2Fjenkins%2Fjob%2Ftest0%2Fconfigure\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEEQVc-gHuleRa9xTluVxI4-YJlIA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A37367%2Fjenkins%2Fjob%2Ftest0%2Fconfigure\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEEQVc-gHuleRa9xTluVxI4-YJlIA&#39;;return true;">http://localhost:37367/jenkins/job/test0/configure
at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:535)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2148)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2128)
at org.jvnet.hudson.test.JenkinsRule$WebClient.getPage(JenkinsRule.java:2084)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1077)
at org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1087)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.ConfigurationRoundTripTest(ClassicUploadStepTest.java:82)
at com.google.jenkins.plugins.storage.ClassicUploadStepTest.testRoundtrip(ClassicUploadStepTest.java:89)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="bYDtwx0-BwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/78d5d980-7105-4cb7-b6a7-c7bdfba193be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.