Giter Club home page Giter Club logo

Comments (8)

sbordet avatar sbordet commented on August 17, 2024

You need to include the dependency for jetty-alpn-java-[client|server] only when using JDK 9.
This is easily done with a Maven profile.

The jar cannot be built with JDK 8 because it uses JDK 9 specific APIs.

from jetty-alpn.

nhenneaux avatar nhenneaux commented on August 17, 2024

from jetty-alpn.

gregw avatar gregw commented on August 17, 2024

Typically we have used either the jetty start.jar modules or Maven profiles to assemble the correct jars.

Unfortunately we can't make this jar a Multi release jar because it users the service loader which cannot be version Ed. Perhaps we can put a dummy java 8 version in the jar that is a noop. I've reopened to consider this.

Also you can now use conscript for ssl which has the same alpn for Java 8 and java 9.

from jetty-alpn.

nhenneaux avatar nhenneaux commented on August 17, 2024

Right Maven profile can be used but only if you directly use Jetty library not if you are building a library that uses Jetty.

What about using a condition just like the NegotiatingServerConnectionFactory class (see https://github.com/eclipse/jetty.project/blob/jetty-9.4.x-1200/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnectionFactory.java#L41) to determine the JVM version and use the service loader only when it is Java 9?

from jetty-alpn.

nhenneaux avatar nhenneaux commented on August 17, 2024

I managed to find a workaround but I don't think it is a recommended way.

Using Jetty 9.4.8, with the following dependencies (in this order I suppose) and build with Java 9. I just have to add alpn-boot (-Xbootclasspath/p:/path/to/alpn-boot.jar) for running with Java 8 and the modules for Java 9 (--add-modules java.activation,java.xml.bind).

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-alpn-java-server</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-alpn-java-client</artifactId>
            <version>${jetty.version}</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-alpn-openjdk8-server</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-alpn-openjdk8-client</artifactId>
            <version>${jetty.version}</version>
        </dependency>

from jetty-alpn.

sbordet avatar sbordet commented on August 17, 2024

Yes this is the correct way.

Artifacts jetty-alpn-java-[client|server] are built by Jetty with target JDK 9, while artifacts jetty-alpn-openjdk8-[client|server] are built with target JDK 8.

A library may ship all artifacts, and Jetty will use the ServiceLoader to load the right implementation at runtime, preferring jetty-alpn-openjdk8-* when the runtime is JDK 8 and jetty-alpn-java-* when the runtime is JDK 9.

Unfortunately you still need the bootclasspath for JDK 8 only, so it's not a completely transparent solution, as you have to change the command line depending on the JDK version.

from jetty-alpn.

gregw avatar gregw commented on August 17, 2024

Note that you may wish to consider using the conscrypt SSL provider with jetty. Not only is it much faster than native SSL, but it supports ALPN in both java8 and java9 without the need to modify the boot path.

https://www.eclipse.org/jetty/documentation/9.4.x/jetty-ssl-distribution.html

Documentation has also been updated for the next release: jetty/jetty.project@904acea

from jetty-alpn.

lindenquan avatar lindenquan commented on August 17, 2024

no more warning, after I excluded JDK 9 version Alpn in Gradle

configurations.forEach {
  it.exclude("org.eclipse.jetty", "jetty-alpn-java-server")
  it.exclude("org.eclipse.jetty", "jetty-alpn-server")
}

from jetty-alpn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.