OS X Leopard exposes Axis2 bug
I upgraded to Leopard on the laptop, got all my apps back, built and installed Fedora, checked out the CTREP tests, ran them and got this error:
java.util.regex.PatternSyntaxException: Dangling meta character ‘*’ near index 0
*.local
Initially I thought it was a mismatch between Axis2/xmlbeans versions between the web services clients and the code I was using at the time. I wracked my brains for 4 hours, modifying build files, generating IDEA projects, cleaning them out and manually putting the dependencies into the IDE. All to no avail. I still got the error.
Then I looked harder at the stack trace:
at java.lang.String.matches(String.java:1921)
at org.apache.axis2.transport.http.ProxyConfiguration.validateNonProxyHosts(ProxyConfiguration.java:261)
that http.ProxyConfiguration looked suspicious especially since I was on the laptop, which is entirely localhost. Then, hell on earth, I googled this:
Axis client fails if http.nonProxyHosts contains * as wildcard
Doing a System.getProperty(“http.nonProxyHosts”), I found this lot:
local|*.local|169.254/16|*.169.254/16
it’s that *.local that is breaking Axis2 as it’s not a valid regexp. It must have appeared in 10.5 as Axis2 1.3 works just fine in 10.4.
I then had a rummage about in OS X and lo and behold found this lot in System Preferences -> Network -> AirPort -> Proxies:Bypass proxy settings… :
*.local, 169.254/16
removing *.local and *.169.254 from the list solves the problem and the tests are all running again. Will watch the Axis2 JIRA with interest.
« Enabling the mountpoint property
Comments
Comment from Bill
Time: 4/6/2008, 10:27 am
This solved the problem that I had with Axis on Leopard.
However if you then run
System.setProperty(“http.nonProxyHosts”,System.getProperty(”http.nonProxyHosts”).replaceAll(”\\*”, “\\\\*”));
on Tiger you get a Null Pointer Exception
Presumably you would get the same on Win XP.
You actually need something like :
if (System.getProperty(“http.nonProxyHosts”)!=null)
{
if (System.getProperty(“http.nonProxyHosts”).contains(“\\*”))
{
System.setProperty(“http.nonProxyHosts”, System.getProperty(“http.nonProxyHosts”).replaceAll(“\\*”, “\\\\*”));
}
}
Make sense ?
Bill
Pingback from Xnoccio – » Errores al utilizar Axis2 en Mac OS X Leopard
Time: 8/9/2008, 2:08 pm
[...] bien, con un poco de Google, me encontré la solución. Resulta que Tomcat dentro de Eclipse recupera la configuración de red de Leopard, y por defecto [...]
Comment from Simon Jackson
Time: 30/9/2008, 3:33 pm
Thanks to all of you – this works a treat.
Comment from D. Oosterveld
Time: 17/4/2009, 9:55 am
Thanks for the tip, I’ll try it out.
It makes more sense to use Pattern#quote() method to escape meta characters of regular expressions, and this probably is what axis2 should do when matching host names.
Comment from Arshia
Time: 23/7/2009, 7:51 pm
I just want to say thank you so much for this post, I did not even think this could be an issue regarding the OS and I probably would have wasted far more hours than you did just to fix some broken unit tests. Also, I love your site design. Thanks again!
Comment from Mohith
Time: 13/10/2009, 11:15 am
It works like a charm. You saved me a lot of time and effort. Now I can hit my web service. Thank you very much.
Comment from Alistair
Time: 13/10/2009, 11:37 am
Glad it was of some use folks!
Comment from SD
Time: 30/4/2008, 10:12 pm
Looks like a way around this is to escape the *’s using \*.
When your java app starts up do this:
System.setProperty(
“http.nonProxyHosts”,
System.getProperty(“http.nonProxyHosts”).replaceAll(“\\*”, “\\\\*”));