JDK-6947327 : REGRESSION: NoSuchMethodError exception throws with jre 1.4 apps
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 6u19
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-04-26
  • Updated: 2010-09-08
  • Resolved: 2010-05-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u21 b05Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
An old version of our app wants to use JRE 1.4.  The JNLP file requests to
be run with a 1.4 JRE.  However, if Java 1.6.0_20 is installed, the 6.0_20
version of webstart downloads the application and launches the app with an
installed version of 1.4.  This is evident from:
      Java Web Start 1.6.0_20
      Using JRE version 1.4.2_10-b03  Java HotSpot(TM) Client VM



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
  To reproduce this bug just create a JNLP file that references a simple java class from a JAR-file, where <j2se version="1.4"> and run it with java web start (1.6.0_20).

1) Build the app from the supplied build source code and the build script
2) run the generated file "dist/jwstest.jnlp" with javaws (1.6.0_20)
3) See the jws console window

Run this with using the webstart in 1.6.0_18 and it works perfectly.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java Web Start 1.6.0_20
Verwendung der JRE-Version 1.4.2_10-b03 Java HotSpot(TM) Client VM
Home-Verzeichnis des Benutzers = C:\Dokumente und Einstellungen\karneimm
----------------------------------------------------
c:   Konsole l����schen
f:   Objekte in Finalisierungswarteschlange finalisieren
g:   Speicherbereinigung
h:   Diese Hilfemeldung anzeigen
m:   Speicherbelegung anzeigen
o:   Protokollierung ausl����sen
p:   Proxy-Konfiguration neu laden
q:   Konsole ausblenden
r:   Richtlinien-Konfiguration neu laden
s:   System- und Bereitstellungseigenschaften ausgeben
t:   Threadliste ausgeben
v:   Thread-Stack ausgeben
0-5: Trace-Stufe auf <n> setzen
----------------------------------------------------
Running.
ACTUAL -
Java Web Start 1.6.0_20
Verwendung der JRE-Version 1.4.2_10-b03 Java HotSpot(TM) Client VM
Home-Verzeichnis des Benutzers = C:\Dokumente und Einstellungen\karneimm
----------------------------------------------------
c:   Konsole l����schen
f:   Objekte in Finalisierungswarteschlange finalisieren
g:   Speicherbereinigung
h:   Diese Hilfemeldung anzeigen
m:   Speicherbelegung anzeigen
o:   Protokollierung ausl����sen
p:   Proxy-Konfiguration neu laden
q:   Konsole ausblenden
r:   Richtlinien-Konfiguration neu laden
s:   System- und Bereitstellungseigenschaften ausgeben
t:   Threadliste ausgeben
v:   Thread-Stack ausgeben
0-5: Trace-Stufe auf <n> setzen
----------------------------------------------------
#### Java Web Start Error: #### java.lang.NoSuchMethodError: sun.net.www.ParseUtil.encodePath(Ljava/lang/String;Z)Ljava/lang/String;


Instead of running the program an error dialog with the following error is shown.

com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoSuchMethodError: sun.net.www.ParseUtil.encodePath(Ljava/lang/String;Z)Ljava/lang/String;
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
 	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
 	at java.net.URLClassLoader$1.run(Unknown Source)
 	at java.security.AccessController.doPrivileged(Native Method)
 	at java.net.URLClassLoader.findClass(Unknown Source)
 	at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
 	at java.lang.ClassLoader.loadClass(Unknown Source)
 	at java.lang.ClassLoader.loadClass(Unknown Source)
 	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
 	at com.sun.javaws.Launcher.run(Unknown Source)
 	at java.lang.Thread.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
------ Main.java --------------------
package app;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class Main {
    
    public static void main(String[] args) {
        System.out.println("Running.");
        JFrame f = new JFrame("Dummy");
        JOptionPane.showMessageDialog(f, "Exit");
        System.exit(0);
    }
}

------ build.xml --------------------

<?xml version="1.0"?>
<project name="jwstest" default="main" basedir=".">
	<description>build the jwstest app</description>

	<property name="compile.debug" value="true" />
	<property name="compile.deprecation" value="false" />
	<property name="compile.optimize" value="true" />
	<property name="compile.source" value="1.2" />
	<property name="compile.target" value="1.2" />

	<!-- Folders -->
	<property name="src.dir" location="${basedir}/src" />
	<property name="build.dir" location="${basedir}/build" />
	<property name="build.classes.dir" location="${build.dir}/classes" />
	<property name="build.bin.dir" location="${build.dir}/bin" />
	<property name="dist.dir" location="${basedir}/dist" />
		
	<!-- Project-specific Settings -->
	<property name="project.title" value="jwstest" />
	<property name="project.version" value="1.0.0" />
	<property name="project.vendor" value="Michael Karneim" />
	<property name="project.homepage" value="file:///${dist.dir}" />
	<property name="project.codebase" value="file:///${dist.dir}" />
	<property name="project.jre" value="1.4.2_10" />
	<property name="project.main" value="app.Main" />

	<!-- Files -->
	<property name="classes.filename" value="${ant.project.name}.jar" />
	<property name="classes.jarfile" value="${dist.dir}/${classes.filename}" />
	<property name="jnlp.filename" value="${ant.project.name}.jnlp" />
	<property name="jnlp.file" value="${dist.dir}/${jnlp.filename}" />

	<!-- Filesets and paths -->
	<fileset id="build.classes.fileset" dir="${build.classes.dir}" description="Compiled classes" />


	<path id="class.path">
		<pathelement path="${currentenv.classpath}" />
	</path>

	<!--#################### Init dynamic properties ########################-->
	<target name="init">
		<tstamp>
			<format property="build.time" pattern="MMM/dd/yyyy hh:mm aa z" />
		</tstamp>
	</target>

	<!--#################### Build targets ########################-->
	<target name="clean" depends="init" description="Clean up all generated files.">
		<delete dir="${dist.dir}" />
		<delete dir="${build.dir}" />
	</target>

	<target name="pre-compile" depends="init">
		<delete dir="${build.classes.dir}" />
		<mkdir dir="${build.classes.dir}" />
	</target>

	<target name="compile" depends="init, pre-compile">
		<javac classpathref="class.path" destdir="${build.classes.dir}" source="${compile.source}" target="${compile.target}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
			<src path="${src.dir}" />
		</javac>
	</target>

	<target name="pre-dist" depends="init">
		<delete dir="${dist.dir}" />
		<mkdir dir="${dist.dir}" />
	</target>

	<target name="create-classes-jar" depends="init, compile" description="Create jar with all classes">
		<delete file="${classes.jarfile}" />
		<jar destfile="${classes.jarfile}">
			<fileset refid="build.classes.fileset" />
			<manifest>
				<attribute name="Build-Date" value="${build.time}" />
				<attribute name="Implementation-Title" value="${project.title}" />
				<attribute name="Implementation-Version" value="${project.version}" />
				<attribute name="Implementation-Vendor" value="${project.vendor}" />
			</manifest>
		</jar>
	</target>
	
	<target name="create-jnlp-file" depends="init">
		<delete file="${jnlp.file}" />
		<echo file="${jnlp.file}" append="false"><![CDATA[
			<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Discriptor 1.1//EN" "http://java.sun.com/dtd/JNLP-1.5.dtd">
	  		<jnlp spec="1.0+" codebase="${project.codebase}" href="${jnlp.filename}">
	  			<information>
  					<title>${project.title}</title>
	  				<vendor>${project.vendor}</vendor>
	  				<homepage href="${project.homepage}" />
	  				<description>${project.description}</description>
	  			</information>
	  		<resources>
  				<j2se version="${project.jre}" href="http://java.sun.com/products/autodl/j2se"
   					  initial-heap-size="64m" max-heap-size="128m" />
	  			<jar href="${classes.filename}" />
	  		</resources>
	  		<application-desc main-class="${project.main}" />
	  		</jnlp>
	  	      ]]>
		</echo>
	</target>
	
	<target name="dist" depends="init, pre-dist, create-classes-jar, create-jnlp-file">
	</target>

	<target name="main" depends="init, dist">
	</target>

</project>



---------- END SOURCE ----------

Release Regression From : 6u18
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION ParseUtil.encodePath(String, boolean) wasn't introduced until later 1.4.2 updates release, create a wrapper to take care of it.
11-05-2010