Oct 24th, 2006, 05:03 PM
Odd error with HttpClient after jmx-modding property
Spring 1.2.8, WebLogic 8.1.4, JDK 1.4.2, httpclient 3.0rc3, commons-modeler 2.0, jmanage 1.5beta.
I have no idea where my problem lies here, but here's what I've seen:
A week or so ago I implemented a prototype of enabling JMX access to my Spring beans in my WebLogic 8.1.4 application. I used the workaround mentioned by Karl Baum to use commons-modeler's BaseModelMBean class. I used one trivial bean, and also a bean to modify the log4j config. This prototype worked perfectly. I could show that debug would appear or disappear depending on the value I dynamically set through jmanage.
Now I've gone further and added to the "beans" list an exsting bean that creates an HttpClient instance and configures it with its set properties. My test case uses basic auth and proxy auth. This code works fine normally.
My first test with this was to change the "timeout" value from the default of 20000 to 19999. When I tried to execute the code after setting that value, it failed with a bizarre problem. The downstream server returned "user authentication required", as if my user auth data was unset. I then stepped through this with Eclipse, and just before it called "executeMethod()", I inspected the HttpClient object, and all the authentication data looked fine. When I executed the method, it failed with the "user authentication required".
If I then redeploy the application, it works fine again. I tried stepping through the code after redeploy, and the HttpClient data seems to be the same as it was after setting the timeout through JMX, except for the timeout value being different by 1. I even tried setting the timeout value back to the default value of 20000, but that still fails.
I don't understand what could be going wrong here.
Oct 24th, 2006, 07:02 PM
Never mind. I figured it out, mostly. There's something odd with how JManage works, but I know how to avoid the problem now.
I made the mistake of filling in the httpTimeout value in the portion of the JManage form that contains all of the property values, and then clicking "Save", as opposed to just calling the "setHttpTimeout" operation directly. After looking closer in the properties form, I noticed that the value it had for the "userAgent" property was "<i>null</i>" for some unknown reason. When I clicked "Save" on the form, it set that bad value for that property, which results in the confusing "user authentication required" error from the downstream server.