„Fun“ with JavaWS and PAC (Proxy AutoConfig)

Using a *.pac / *.dat file for proxy auto-configuration is a very useful thing, especially in enterprise environments. Generally, JavaWS supports using PAC. But sadly, Oracle’s current JRE versions (7u71 / 7u72) refuse to use a PAC file that makes use of of JavaScript functions like dnsDomainIs(). Using such a PAC file will lead to errors like this:

javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function dnsResolve in object com.sun.deploy.net.proxy.SunAutoProxyHandler@e04204. (<Unknown source>#34) in <Unknown source> at line number 34

Caused by: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function dnsResolve in object com.sun.deploy.net.proxy.SunAutoProxyHandler@e04204. (<Unknown source>#34)

This looks like JDK-8038986 and JDK-6945158. So, it seems to be fixed in current version of OpenJDK, and hopefully, it gets fixed in Oracle’s JRE’s, too. In the meanwhile, the workaround found at JDK-6945158 worked for me, too: make sure that the PAC file returns anything without using dnsDomainIs(), for example using a Regex-based test like shExpMatch (thanks os!) or doing a simple string comparison like

if (host==“[hostname]“)
return „PROXY proxy_host:proxy_port“;

E-Mail Notifications on RoR exceptions

P: Find a solution to receive e-mail notifications on errors or exceptions occuring in my RoR app.

Railscasts regarding exception handling and notifications:

  • #53: Handling Exceptions
  • #104: Exception Notifications

Available solutions:

–> no optimal solution, maybe exception_notification oder exception_logger?