Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » RCP Web Start stops working with Java 7 update 45(Launch fails)
RCP Web Start stops working with Java 7 update 45 [message #1139836] Wed, 16 October 2013 01:56 Go to next message
Dylan McReynolds is currently offline Dylan McReynoldsFriend
Messages: 30
Registered: July 2009
Member
On both Windows and Mac, today's Java 7 Update 45 breaks our WebStart delivered RCP application. It looks like the launcher code isn't even being executed. I'm not getting any eclipse logging written. I have tracing and logging turned on in the Java Control panel, and get a log in [user.home]\AppData\LocalLow\Sun\Java\Deployment\log\*.trace:

Log started: Tue, 15 Oct 2013 15:40:55 -0700
Java Web Start 10.45.2.18
Using JRE version
1.7.0_45-b18 Java HotSpot(TM) 64-Bit Server VM


Not much to go on.

I've run a debugger against the app, and am not getting to any of my code in my WorkbenchAdvisor or WorkbenchWindowAdvisor implementations.

Any ideas?

Thanks.
Re: RCP Web Start stops working with Java 7 update 45 [message #1139917 is a reply to message #1139836] Wed, 16 October 2013 03:19 Go to previous messageGo to next message
Dylan McReynolds is currently offline Dylan McReynoldsFriend
Messages: 30
Registered: July 2009
Member
I've got the com.eclipse.equinox.launcher plugin source in the debugger. The bundle loader for my bundle throws (and swallows) a ClassNotFoundException trying to load my IApplication implementation. Something changed a lot in classloading for web start on Java 7 Update 45.
Re: RCP Web Start stops working with Java 7 update 45 [message #1140577 is a reply to message #1139836] Wed, 16 October 2013 13:04 Go to previous messageGo to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Quote:
I've got the com.eclipse.equinox.launcher plugin source in the debugger. The bundle loader for my bundle throws (and swallows) a ClassNotFoundException trying to load my IApplication implementation. Something changed a lot in classloading for web start on Java 7 Update 45.


Same here.

I dug up an eclipse log file referenced in the trace file that is logged into the java deployment folder which says "Runtime Exception - No application id has been found". Maybe this is also related to the new java security features so that the bundle that should install the application is blocked by the java sandbox. As we have several warnings on the java console during startup claiming that manifest attributes are missing I'm trying to add those new attributes to all the jar files to get rid of the warnings. Maybe that helps.

Ok, I had not much hope on this one. Didn't help.

Yesterday I had a working webstart app with some warnings on the console. Now I have an app that shows no warnigs and is cutting edge secure, but doesn't work. Nice going Oracle.

[Updated on: Wed, 16 October 2013 13:41]

Report message to a moderator

Re: RCP Web Start stops working with Java 7 update 45 [message #1140696 is a reply to message #1140577] Wed, 16 October 2013 14:44 Go to previous messageGo to next message
Dylan McReynolds is currently offline Dylan McReynoldsFriend
Messages: 30
Registered: July 2009
Member
I managed to get all of the warnings to go away by adding manifest entries, but still no luck launching the application.
Re: RCP Web Start stops working with Java 7 update 45 [message #1141706 is a reply to message #1140696] Thu, 17 October 2013 06:31 Go to previous messageGo to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Dylan McReynolds wrote on Wed, 16 October 2013 10:44
I managed to get all of the warnings to go away by adding manifest entries, but still no luck launching the application.


Same here. Can someone tell me how to get the source code imported for the launcher so I can debug the start process. I got the eclipse debugger working remotely with the webstart application, but I can't attach the source code for the class EclipseStarter.
Re: RCP Web Start stops working with Java 7 update 45 [message #1141713 is a reply to message #1140696] Thu, 17 October 2013 06:34 Go to previous messageGo to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Dylan McReynolds wrote on Wed, 16 October 2013 10:44
I managed to get all of the warnings to go away by adding manifest entries, but still no luck launching the application.


I tried to debug the starting process, too but can't semm to find and attach the right source files for the class EclipseStarter.

Dylan, how did you attach the sources?
Re: RCP Web Start stops working with Java 7 update 45 [message #1142695 is a reply to message #1141713] Thu, 17 October 2013 20:07 Go to previous messageGo to next message
Dylan McReynolds is currently offline Dylan McReynoldsFriend
Messages: 30
Registered: July 2009
Member
I did Import > Import Plugins and Fragments, selecting the "Projects with Source Folders". Then I found the org.eclipse.equinox.launcher plugin and imported it. I think that was it.
Re: RCP Web Start stops working with Java 7 update 45 [message #1142753 is a reply to message #1142695] Thu, 17 October 2013 20:54 Go to previous messageGo to next message
Dylan McReynolds is currently offline Dylan McReynoldsFriend
Messages: 30
Registered: July 2009
Member
I'm close to the solution.

1. New manifest entries
Permissions: all-permissions
Codebase: [codebase] (maybe not an absolute requirement)
Application-name: [app name] (also maybe not required

2. Moving properties
I send eclipse startup arguments to the Framework with property tags. This no longer works in u45 unless you signed your JNLP (and for me, that didn't seem to work either.) I can't sign my jnlp because there are some cases where I'm using a dynamically-generated one.

So, I moved them from element tags in resource tags into command line arguments. The major one that had to change was eclipse.product.

Before:
<property
name="eclipse.product"
value="my.product"/>

After:
<application-desc main-class="org.eclipse.equinox.launcher.WebStartMain">
<argument>-nosplapsh</argument>
<argument>-product</argument>
<argument>my.product</argument>
</application-desc>

I still have to test other ones...I use @user.home to set configuration area...not sure how that's going to work.

<property
name="osgi.configuration.area"
value="@user.home/appdir"/>
<property
name="osgi.instance.area"
value="@user.home/appdir"/>

Re: RCP Web Start stops working with Java 7 update 45 [message #1149634 is a reply to message #1142753] Tue, 22 October 2013 07:49 Go to previous messageGo to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
I found a solution, too. Apparently properties aren't blocked if they have the prefix "jnlp". So an easy way to come around is to add the prefix to all the properties that are used. Of course the eclipse framework will not find these properties because of the prefix, but if one deploys his own launcher class that simply reads all "jnlp" properties and just resets them without the prefix, everything works fine. Adding your own launcher is quite easy, as it is possible to just forward the start to the equinox WebStartMain.

I added my own launcher to a new plugin which I put into the feature of which my product consists and made a reference to the jar in the jnlp file in addition to the reference to the equinox launcher (second line is new):

<jar href="plugins/org.eclipse.equinox.launcher_1.2.0.v20101119.jar"/>
<jar href="plugins/com.tp.webstart_1.0.0.jar"/>

Properties have to be changed from

<property
name="eclipse.product"
value="com.tp.someProduct"/>

to

<property
name="jnlp.eclipse.product"
value="com.tp.someProduct"/>

At last, I changed the class that is launched in the application-desc section:

<application-desc main-class="com.tp.webstart.WebStartLauncher">
.

The WebstartLauncher class is as simle as follows:

import java.util.Properties;
import java.util.Set;

import org.eclipse.equinox.launcher.WebStartMain;

public class WebStartLauncher {

    /**
    * @param args
    */
    public static void main(String[] args) {
    Properties properties = System.getProperties();
    // copy properties to avoid ConcurrentModificationException
    Properties copiedProperties = new Properties();
    copiedProperties.putAll(properties);
    Set<Object> keys = copiedProperties.keySet();
    for (Object key : keys) {
        if (key instanceof String) {
            String keyString = (String) key;
        	if (keyString.startsWith("jnlp.")) {
    	        // re set all properties starting with the jnlp-prefix 
                // and set them without the prefix
	        String property = System.getProperty(keyString);
	        String replacedKeyString = keyString.replaceFirst("jnlp.", "");

                System.setProperty(replacedKeyString, property);
	    }
        }
    }

    WebStartMain.main(args);
}


That should do it, at least it worked for me.

I hope this helps anyone that is having the same headaches I had the last days.

[Updated on: Tue, 22 October 2013 07:53]

Report message to a moderator

Re: RCP Web Start stops working with Java 7 update 45 [message #1162279 is a reply to message #1142753] Wed, 30 October 2013 09:12 Go to previous messageGo to next message
Hongtao Zhao is currently offline Hongtao ZhaoFriend
Messages: 3
Registered: October 2013
Junior Member
I also have the problem. Can anyone provide the details information for step 1 of your solution. I don't know how to add these attributes(Permissions,Codebase,Application-name) in the MANIFEST.MF of Eclipse JARS.
From my point of view, it's difficult to modify MANIFEST.MF of a signed JAR. How can you achieve this?
Re: RCP Web Start stops working with Java 7 update 45 [message #1169903 is a reply to message #1162279] Mon, 04 November 2013 09:13 Go to previous messageGo to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Hongtao Zhao wrote on Wed, 30 October 2013 05:12

From my point of view, it's difficult to modify MANIFEST.MF of a signed JAR. How can you achieve this?


This is simply not possible, as the signing process is designed to prevent modification of files that are in a signed jar. After adding those attributes to the MANIFEST.MF files, the correspondig jar archives need to be re signed.

I wrote an ant script that unpacks every jar archive, deletes signer information from previous signings by deleting any *.SF, *.DSA or *.RSA files, adds the attributes using the ant manifest task and then re-signs the jar archives using our certificate, which, as far as I know, cannot be a self generated certificate anymore.

Such an ant script is not very hard to write, the bigger problem for you might be that you have to buy a certificate from a CA if you don't have one already.

Here the ant snippet I used to do the work:


<!-- put that somwhere in your main target -->

<!-- set security manifest attributes in jar files -->
<foreach target="unsignJarAndSetManifestAttributes" param="jar" inheritall="true">
   <fileset dir="${pluginsBuildPath}" includes="**/*.jar" />
</foreach>

<foreach target="unsignJarAndSetManifestAttributes" param="jar" inheritall="true">
  <fileset dir="${featuresBuildPath}" includes="**/*.jar" />
</foreach>

<signjar alias="${sign.alias}" keystore="${sign.keystore}"   storepass="${sign.storepass}" keypass="${sign.keypass}">
   <path>
       <fileset dir="${featuresBuildPath}" includes="**/*.jar" />
   </path>
</signjar>

<signjar alias="${sign.alias}" keystore="${sign.keystore}" storepass="${sign.storepass}" keypass="${sign.keypass}">
    <path>
        <fileset dir="${pluginsBuildPath}" includes="**/*.jar" />
    </path>
</signjar>

<!-- the foreach task calls the following target -->

<!-- =================================
	          target: unsignJar
	         ================================= -->
<target name="unsignJarAndSetManifestAttributes">
    <property name="unjarredTempPath" value="${working.dir}\unjarredTemp" />
    <unzip src="${jar}" dest="${unjarredTempPath}" />
    <!-- delete the archive that was just unpacked -->
    <delete file="${jar}" />
    <!-- remove old signer information -->
    <delete>
        <fileset dir="${unjarredTempPath}\META-INF" includes="**/*.RSA" />
        <fileset dir="${unjarredTempPath}\META-INF" includes="**/*.SF" />
        <fileset dir="${unjarredTempPath}\META-INF" includes="**/*.DSF" />
    </delete>
    <manifest file="${unjarredTempPath}\META-INF\MANIFEST.MF" mode="update">
        <attribute name="Trusted-Only" value="true" />
        <attribute name="Trusted-Library" value="true" />
        <attribute name="Permissions" value="all-permissions" />
        <attribute name="Codebase" value="*" />
        <attribute name="Application-Name" value="[YOUR_APPLICATION_NAME]" />
    </manifest>
    <zip destfile="${jar}" basedir="${unjarredTempPath}" />
    <delete dir="${unjarredTempPath}" />
</target>



I hope the used variables are self-explanatory. The variables ${pluginsBuildPath} and ${featuresBuildPath} have to point to the plugins- and features- folders of your RCP webstart application.

Please note that the foreach task is NOT part of a standard ant installation. You'll need AntContrib for this. Download it an add the tasks using the following somewhere in your an script (e.g. an init task):

<!-- Set class path to AntContrib library -->
<path id="antcontrib.classpath">
    <fileset dir="${antcontrib.classpath}">
        <include name="*.jar" />
    </fileset>
</path>
<typedef resource="net/sf/antcontrib/antlib.xml" classpathref="antcontrib.classpath" />



Replace ${antcontrib.classpath} with the path that points to the AntContrib jar archive you downloaded.

Hope that helps.

Tom

P.S. I'm not really sure when to use the Trusted-Only and Trusted-Library attributes, it could be that setting the one attribute contradicts using the other, the documentation about that got me confused a little. But still, setting them both worked for me.


Re: RCP Web Start stops working with Java 7 update 45 [message #1169930 is a reply to message #1169903] Mon, 04 November 2013 09:38 Go to previous messageGo to next message
Hongtao Zhao is currently offline Hongtao ZhaoFriend
Messages: 3
Registered: October 2013
Junior Member
My idea is same as you. Currently, this step is not necessary. After investigation, I find it just needs to add these three attributes in the launcher jar and add prefix 'jnlp.' for all properties. Now, my problem has been solved. Whatever, thank you very much. Smile
Re: RCP Web Start stops working with Java 7 update 45 [message #1249808 is a reply to message #1139836] Tue, 18 February 2014 16:59 Go to previous messageGo to next message
SlowStrider Mising name is currently offline SlowStrider Mising nameFriend
Messages: 115
Registered: July 2009
Senior Member
@Thomas Haskes your ant script saved my day!

I tried manually adding the entries to the equinox launcher manifest, but this doesn't
work. It seems that classes from jars whose manifest don't have the security entries cannot be loaded.

Please vote for this being fixed in Eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=421294

[Updated on: Tue, 18 February 2014 16:59]

Report message to a moderator

Re: RCP Web Start stops working with Java 7 update 45 [message #1250512 is a reply to message #1139836] Wed, 19 February 2014 10:08 Go to previous messageGo to next message
SlowStrider Mising name is currently offline SlowStrider Mising nameFriend
Messages: 115
Registered: July 2009
Senior Member
Note that I was able to reduce the runtime of the script by a factor 4 to 5 by parallelizing the ant tasks. You can add this to <foreach>:

parallel="true" maxThreads="${threadCount}"


Define
<property name="threadCount" value="12"/>


(experiment with this number to find the best value)

You have to prevent parallel threads from using the same temp directory, so use this:

<tempfile property="unjarredTempPath" destDir="${workspace.dir}\temp" prefix="unjarredTemp"/>


Signjar can be paralellized using:
		<foreach target="signjar" param="jar" inheritall="true" parallel="true" maxThreads="${threadCount}">
			<fileset dir="${featuresBuildPath}" includes="**/*.jar" />
		</foreach>

	<target name="signjar">
		<signjar alias="${sign.alias}" keystore="${sign.keystore}" storepass="${sign.storepass}" keypass="${sign.keypass}">			
			<path>
				<fileset file="${jar}" />
			</path>
		</signjar>
	</target>


Optionally add tsaurl="https://timestamp.geotrust.com/tsa" to timestamp the signed jars which is recommended to make them still trusted after the certificate expiry date. Note: I did not test whether this is actually true for geotrust. Does add some extra running time.

[Updated on: Wed, 19 February 2014 10:09]

Report message to a moderator

Re: RCP Web Start stops working with Java 7 update 45 [message #1251736 is a reply to message #1250512] Thu, 20 February 2014 14:46 Go to previous message
SlowStrider Mising name is currently offline SlowStrider Mising nameFriend
Messages: 115
Registered: July 2009
Senior Member
I found that ec key will generate .ec file. We can also get a further performance increase when not unpacking the jars to temporary directories but updating the manifest in-place and creating a new jar from existing jar except for the files that should be deleted:

	<target name="unsignJarAndSetManifestAttributes" depends="unsignJar, setManifestAttributes">
	</target>

	<target name="unsignJar">
		<move file="${jar}" tofile="${jar}.temp" />
		<zip destfile="${jar}">
		    <zipfileset src="${jar}.temp" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSF,META-INF/*.EC" />
		</zip>		
		<delete file="${jar}.temp" />
	</target>
	
	<target name="setManifestAttributes">
		<jar file="${jar}" update="true">
			<manifest>
				<attribute name="Trusted-Only" value="true" />
				<attribute name="Trusted-Library" value="true" />
				<attribute name="Permissions" value="all-permissions" />
				<attribute name="Codebase" value="*" />
				<attribute name="Application-Name" value="<your application name>" />
			</manifest>
		</jar>
	</target>
Previous Topic:SWT popup menu not working
Next Topic:Re: Plugin installation with XULRunner 24
Goto Forum:
  


Current Time: Thu Nov 27 16:37:16 GMT 2014

Powered by FUDForum. Page generated in 0.03295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software