How to create jnlp bundle using Maven

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
jergan
Posts: 3
Joined: 26 May 2020, 15:54

How to create jnlp bundle using Maven

Post by jergan »

Hi.

I have for many years used Java Web Start to deploy applications. Now I consider moving to openwebstart.

Currently I build the bundle of files using the Maven plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-beta-7</version>
</plugin>
This interprets all dependencies, generates my jnlp files, collect all the required jar files and signs them.
These files are then deployed to the server and fetched by Java Web Start using https.

However, post JDK 8 this does not work anymore, the jar signing step breaks:
Caused by: java.lang.NoClassDefFoundError: Lorg/codehaus/mojo/keytool/KeyTool;
(I have not searched too far into this, and this plugin has not been maintained for ages.)

And my goal is to run with openjdk 14 on both client side, server side and at build time.

My question:
1) How do you guys build your server site files (for example as part of a Maven build)?

2) Is not signing the jar files an alternative? On other words, how will openwebstart handle unsigned jar files?

Regards,
Øyvind Jergan

Janak Mulani
Posts: 725
Joined: 24 Mar 2020, 13:37

Re: How to create jnlp bundle using Maven

Post by Janak Mulani »

Hi,

This is really a Maven question. I cannot say what is the problem in your set up,

However I can share the way we have built jar files for deployment when we do tests. So following the pom of the project which has java programs as maven modules. It uses Maven's jar and jar-signer plugins. The keystore is in the project' root directory.

Code: Select all

project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.karakun.ows</groupId>
    <artifactId>openwebstart-samples</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <modules>
        <module>webstart-monitor</module>
        <module>extended-service-sample</module>
        <module>lazy-loading-sample</module>
        <module>test-missing-certificate</module>
        <module>webstart-server</module>
        <module>jvm_args</module>
        <module>jvm-server</module>
        <module>auth-server</module>
        <module>popupmenu</module>
        <module>javafx-test</module>
    </modules>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Title>OWS Sample</Implementation-Title>
                            <Implementation-Vendor>Karakun AG</Implementation-Vendor>
                            <Permissions>all-permissions</Permissions>
                            <Codebase>*</Codebase>
                            <Application-Library-Allowable-Codebase>*</Application-Library-Allowable-Codebase>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jarsigner-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>signme</id>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <keystore>${session.executionRootDirectory}/owstestKeyStore</keystore>
                    <alias>ulctest</alias>
                    <storepass>ulctest</storepass>
                    <keypass>ulctest</keypass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
I hope this helps.

- Janak

jergan
Posts: 3
Joined: 26 May 2020, 15:54

Re: How to create jnlp bundle using Maven

Post by jergan »

Hi Janak.

Thanks for the answer.

My understanding is that your example invokes the maven-jar-plugin and signs jar files.
This is all good.

However, the problem is am trying to solve (which I think is quite common to most applications deployed with Java Web Start) is like this:
I have an application represented by a maven module. This module have some maven dependencies, which again might have other maven dependencies.
What I would like is a maven plugin that
1) Interprets all the maven dependencies (include the transitive dependencies). This will produce the list of jar files required for the client footprint.
2) Based on the list from 1) creates a JNLP file containing the correct list of dependencies.
3) Based on the list from 1) signs all the files.
4) Puts the results from 2) and 3) into a (ZIP?) archive, with is again available from the maven module creating a WAR archive.

I fully agree creating such a plugin not the core business of open web start.
However, I think that many users of open web start would benefit from such a plugin.
And as many of us have been using the webstart-maven-plugin, I was hoping that someone would have an alternative that was working for post JDK 8.

Do you have knowledge about such a plugin?


Second question again: It is possible to run an application based on unsigned jar files in open web start?


Regards,
Øyvind Jergan

Janak Mulani
Posts: 725
Joined: 24 Mar 2020, 13:37

Re: How to create jnlp bundle using Maven

Post by Janak Mulani »

> Do you have knowledge about such a plugin?

I don't know of a Maven plugin that generates Jnlp based on dependencies and signs the dependency jars.

However you could create one fat jar using Maven plugin Maven Assembly Plugin or Maven Shade Plugin. You can look this up on the net.

> Is not signing the jar files an alternative? On other words, how will openwebstart handle unsigned jar files?

You will get :

Code: Select all

Caused by: net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed.

jergan
Posts: 3
Joined: 26 May 2020, 15:54

Re: How to create jnlp bundle using Maven

Post by jergan »

Hi Janak.

Again thanks for your answers.

As I am responsible for several applications all built with Maven and deployed using Java Web Start,
it looks like the best solution for me would to to build a new Maven plugin based on the Maven dependency plugin and the Maven jar plugin.
This new plugin will then generate the same files as the historic Web Start Plugin and thus be compatible with OpenWebStart.

I will see whether I can convince the company I work for to open-source this, as I think it could be useful for applications moving from Java Web Start to OpenWebStart.


Last question for now: Does there exist a technical specification on how the OpenWebStart interprets the JNLP file
(for example if something is now different than how things were done in Java Web Start).

Regards,
Øyvind Jergan

Stephan Classen
Posts: 232
Joined: 27 Mar 2020, 09:55

Re: How to create jnlp bundle using Maven

Post by Stephan Classen »

It should work the same as oracle's java web start.
We currently have some issue when the main jar file is not in the root JNLP.
So try to avoid having the main jar in an extension

Janak Mulani
Posts: 725
Joined: 24 Mar 2020, 13:37

Re: How to create jnlp bundle using Maven

Post by Janak Mulani »

Hi

OWS is based on Adopt Open Ice Tea Web https://github.com/AdoptOpenJDK/IcedTea-Web which is based on JSR-56 : https://jcp.org/aboutJava/communityproc ... ndex7.html

The implemented features are listed at : https://openwebstart.com/feature-table/

If you need additional features you can post in the OWS Features and Support Forum and we will get back to you.

> This new plugin will then generate the same files as the historic Web Start Plugin and thus be compatible with OpenWebStart

If you already have a tool to generate Jnlp from Dependencies then that should work with OWS too.

Thanks

Janak

Daniel_B
Posts: 3
Joined: 10 Dec 2021, 11:03

Re: How to create jnlp bundle using Maven

Post by Daniel_B »

Hello,

I'm looking for maven deployment solution of open webstart JDK 11 (+JavaFX 17) applications.

I used the following maven tasks in this direction:
1. build an application jar via the maven-jar-plugin (org.apache.maven.plugins)
2. copy-dependencies via the maven-dependency-plugin (org.apache.maven.plugins) to a specific folder
3. sign all jars (include the application jar) via the maven-jarsigner-plugin (org.apache.maven.plugins)

as last task I would like to create a JNLP file for this project via maven plugin to load the application and all dependency jar's.
But I found no working possibility to to automate this.

Has anyone found a solution for this last task?

Best regards
Daniel

Post Reply