|
|
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 |
Thomas Haskes 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 #1149634 is a reply to message #1142753] |
Tue, 22 October 2013 07:49 |
Thomas Haskes 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 #1169903 is a reply to message #1162279] |
Mon, 04 November 2013 09:13 |
Thomas Haskes 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 #1250512 is a reply to message #1139836] |
Wed, 19 February 2014 10:08 |
Henno Vermeulen Messages: 126 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 #1745261 is a reply to message #1149634] |
Fri, 07 October 2016 06:18 |
Jimmy Dom Messages: 3 Registered: August 2016 |
Junior Member |
|
|
Thomas Haskes wrote on Tue, 22 October 2013 07:49I 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.
I tried this source and settings on my Java web start settings. I don't have any errors after changing the main class to the custom main. But the Java web start doesn't launch the Eclipse E4 application. It doesn't throw any logs and kills itself after a few seconds.
My main jnlp file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp
spec="1.0+"
codebase="http://localhost:80"
href="test.jnlp"> <!-- URL to the site containing the jnlp application. It should match the value used on export. Href, the name of this file -->
<information>
<!-- user readable name of the application -->
<title>CR-IT System Platform</title>
<!-- vendor name -->
<vendor></vendor>
<!-- vendor homepage -->
<homepage href="My company website" />
<!-- product description -->
<description></description>
<icon kind="splash" href="splash.gif"/>
</information>
<!--request all permissions from the application. This does not change-->
<security>
<all-permissions></all-permissions>
</security>
<!-- The name of the main class to execute. This does not change-->
<!--<application-desc main-class="org.eclipse.equinox.launcher.WebStartMain" />-->
<application-desc main-class="com.atlascopco.webstart.WebStartLauncher ">
<argument>-nosplash</argument>
</application-desc>
<resources>
<!-- Reference to the launcher jar. The version segment must be updated to the version being used-->
<!--<jar href="plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar"/>-->
<jar href="plugins/webstart.jar"/>
<!-- Reference to all the plugins and features constituting the application -->
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins necessary -->
<extension
name="Wrapper feature"
href="features/CR_IT_Client_Feature_1.0.0.new.jnlp"/>
<!-- Information usually specified in the config.ini-->
<property name="jnlp.osgi.bundles"
value="org.eclipse.core.runtime@4:start,
org.eclipse.equinox.common@3:start,
org.eclipse.equinox.ds@2:start,org.
eclipse.equinox.simpleconfigurator@1:start"/>
<!-- The id of the product to run, like found in the overview page of the product editor -->
<property
name="jnlp.eclipse.product"
value="CR-IT_client.product"/>
<property name="jnlp.osgi.useReliableFiles" value="read,write" />
<property name="jnlp.osgi.parentClassloader" value="current"/>
<property name="jnlp.eclipse.security" value="osgi" />
</resources>
<!-- Indicate on a platform basis which JRE to use -->
<resources os="Windows">
<j2se version="1.7" />
</resources>
</jnlp>
|
|
|
Re: RCP Web Start stops working with Java 7 update 45 [message #1745263 is a reply to message #1149634] |
Fri, 07 October 2016 06:39 |
Jimmy Dom Messages: 3 Registered: August 2016 |
Junior Member |
|
|
Thomas Haskes wrote on Tue, 22 October 2013 07:49I 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.
|
|
|
Powered by
FUDForum. Page generated in 0.08346 seconds