JDK-8147776 : Rhino fails to evaluate autoconfig-script when used via JavaWS
  • Type: Bug
  • Component: deploy
  • Affected Version: 7u72
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-09-30
  • Updated: 2016-01-20
  • Resolved: 2016-01-20
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) Client VM (build 24.72-b04, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

EXTRA RELEVANT SYSTEM CONFIGURATION :
No direct internet access, http proxy required.

A DESCRIPTION OF THE PROBLEM :
The JavaScript engine Rhino is unable to evaluate an autoproxy configuration when in deployment.properties deployment.proxy.auto.config.url is used and the autoconfig script contains any function that calls dnsResolve.

The problem is almost identical to the issue described in http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8038986.

REGRESSION.  Last worked in version 7u67

ADDITIONAL REGRESSION INFORMATION: 
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) Client VM (build 24.72-b04, mixed mode, sharing)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8038986

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8038986
ACTUAL -
No proxy is used. Trying direct access failes.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Java Web Start 10.72.2.14
JRE-Version verwenden 1.7.0_72-b14 Java HotSpot(TM) Client VM
Benutzer-Home-Verzeichnis = C:\Users\[username_deleted]
----------------------------------------------------
c:   Konsolenfenster l��schen
f:   Objekte in Finalisierungs-Queue finalisieren
g:   Garbage Collect
h:   Diese Hilfemeldung anzeigen
m:   Speicherauslastung drucken
o:   Logging ausl��sen
p:   Proxykonfiguration neu laden
q:   Konsole ausblenden
r:   Policy-Konfiguration neu laden
s:   System- und Deployment-Eigenschaften ausgeben
t:   Threadliste ausgeben
v:   Threadstack ausgeben
0-5: Traceebene auf <n> setzen
----------------------------------------------------
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
	at com.sun.script.javascript.RhinoScriptEngine.invoke(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.access$100(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.getProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.DynamicProxyManager.getProxyList(Unknown Source)
	at com.sun.deploy.net.proxy.DeployProxySelector.select(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
	at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.checkUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.launch(Unknown Source)
	at com.sun.javaws.Main.launchApp(Unknown Source)
	at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
	at com.sun.javaws.Main.access$000(Unknown Source)
	at com.sun.javaws.Main$1.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
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)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError2(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThisHelper(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThis(Unknown Source)
	at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Unknown Source)
	at sun.org.mozilla.javascript.internal.Interpreter.interpret(Unknown Source)
	at sun.org.mozilla.javascript.internal.InterpretedFunction.call(Unknown Source)
	at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1.access$200(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(Unknown Source)
	at sun.org.mozilla.javascript.internal.InterpretedFunction.call(Unknown Source)
	... 30 more
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
	at com.sun.script.javascript.RhinoScriptEngine.invoke(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.access$100(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.SunAutoProxyHandler.getProxyInfo(Unknown Source)
	at com.sun.deploy.net.proxy.DynamicProxyManager.getProxyList(Unknown Source)
	at com.sun.deploy.net.proxy.DeployProxySelector.select(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
	at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
	at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.checkUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.launch(Unknown Source)
	at com.sun.javaws.Main.launchApp(Unknown Source)
	at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
	at com.sun.javaws.Main.access$000(Unknown Source)
	at com.sun.javaws.Main$1.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
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)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError2(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThisHelper(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThis(Unknown Source)
	at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Unknown Source)
	at sun.org.mozilla.javascript.internal.Interpreter.interpret(Unknown Source)
	at sun.org.mozilla.javascript.internal.InterpretedFunction.call(Unknown Source)
	at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1.access$200(Unknown Source)
	at com.sun.script.javascript.RhinoScriptEngine$1$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(Unknown Source)
	at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(Unknown Source)
	at sun.org.mozilla.javascript.internal.InterpretedFunction.call(Unknown Source)
	... 40 more
#### Java Web Start Error:
#### [target_hostname_deleted]


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
The workaround described in http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6945158 works for me: 

"use 'if (host=="host.domain.com") { return "DIRECT"; }' to specify which servers that the java application needs to use and go direct. If I put this at the top of the PAC file before any of the functions, it seems to work OK. But this is definitely not a good solution since I won't know what URLs need to go direct and which should use a proxy until they break."

In other words: make sure that the PAC file can return a destination value without trying to call dnsResolve(), dnsDomainIs() or isInNet. The easiest way to achieve this is to do a simple string comparison using ==.


Comments
This is fixed in JDK 7u72 with JDK-8064334. Closing as duplicate.
20-01-2016

JDK 8 includes nashorn.
09-10-2015