ALPN not available for JDK SSL/TLS engine · Issue #3387 · eclipse-vertx/vert.x

I created a simple grpc application with ssl on vertx but got error (my mac osx:v10.14.16, openssl : v1.1.1f, vertx 3.9.0)
the sample code:
VertxServer rpcServer = VertxServerBuilder.
forAddress(vertx, "localhost", 443).
addService(service).
useSsl(opt ->
opt.setSsl(true).setUseAlpn(true).setKeyStoreOptions(
new JksOptions().setPath("tls/server-keystore.jks").setPassword("wibble"))
).
build();

rpcServer.start(ar -> {
  if (ar.succeeded()) {
    System.out.println("RPC server started!");
  }
  else {
    System.out.println("Could not start server " + ar.cause().getMessage());
  }
});

the jks file is copied from vertx-examples and pom.xml looks like below(I just modified some senseitive info):

4.0.0

org.xxx
yyy
1.0.0-SNAPSHOT

UTF-8

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
<exec-maven-plugin.version>1.5.0</exec-maven-plugin.version>

<vertx.version>3.9.0</vertx.version>
<junit-jupiter.version>5.4.0</junit-jupiter.version>

<main.verticle>org.xxx.yyy.MainVerticle</main.verticle>
<vertx.grpc.version>1.16.1</vertx.grpc.version>
<jetty.alpnAgent.version>2.0.7</jetty.alpnAgent.version>
<os.detected.classifier>osx-x86_64</os.detected.classifier>
<jetty.alpnAgent.path>${settings.localRepository}/org/mortbay/jetty/alpn/jetty-alpn-agent/${jetty.alpnAgent.version}/jetty-alpn-agent-${jetty.alpnAgent.version}.jar</jetty.alpnAgent.path>

io.vertx vertx-stack-depchain ${vertx.version} pom import io.vertx vertx-grpc io.vertx vertx-junit5 test com.binance.api binance-api-client 1.0.1 org.junit.jupiter junit-jupiter-api ${junit-jupiter.version} test org.junit.jupiter junit-jupiter-engine ${junit-jupiter.version} test com.google.protobuf protobuf-java-util 3.5.1 com.google.guava guava io.netty netty-tcnative-boringssl-static 2.0.29.Final org.mortbay.jetty.alpn jetty-alpn-agent ${jetty.alpnAgent.version} kr.motd.maven os-maven-plugin 1.4.1.Final maven-compiler-plugin 3.1 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin -javaagent:${jetty.alpnAgent.path}

<plugins>
  <plugin>
    <groupId>org.xolstice.maven.plugins</groupId>
    <artifactId>protobuf-maven-plugin</artifactId>
    <version>0.5.0</version>
    <configuration>
      <!--
        The version of protoc must match protobuf-java. If you don't depend on
        protobuf-java directly, you will be transitively depending on the
        protobuf-java version that grpc depends on.
      -->
      <protocArtifact>com.google.protobuf:protoc:3.4.0:exe:${os.detected.classifier}</protocArtifact>
      <pluginId>grpc-java</pluginId>
      <pluginArtifact>io.vertx:protoc-gen-grpc-java:1.25.0:exe:${os.detected.classifier}</pluginArtifact>
    </configuration>
    <executions>
      <execution>
        <id>compile</id>
        <configuration>
          <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
          <clearOutputDirectory>false</clearOutputDirectory>
        </configuration>
        <goals>
          <goal>compile</goal>
          <goal>compile-custom</goal>
        </goals>
      </execution>
      <execution>
        <id>test-compile</id>
        <goals>
          <goal>test-compile</goal>
          <goal>test-compile-custom</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
  </plugin>
  <plugin>
    <artifactId>maven-shade-plugin</artifactId>
    <version>${maven-shade-plugin.version}</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <transformers>
            <transformer
              implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
              <manifestEntries>
                <Main-Class>io.vertx.core.Launcher</Main-Class>
                <Main-Verticle>${main.verticle}</Main-Verticle>
              </manifestEntries>
            </transformer>
            <transformer
              implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
              <resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource>
            </transformer>
          </transformers>
          <artifactSet>
          </artifactSet>
          <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar
          </outputFile>
        </configuration>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
  </plugin>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>${exec-maven-plugin.version}</version>
    <configuration>
      <mainClass>io.vertx.core.Launcher</mainClass>
      <arguments>
        <argument>run</argument>
        <argument>${main.verticle}</argument>
      </arguments>
    </configuration>
  </plugin>
</plugins>

原网址: 访问
创建于: 2021-09-08 18:25:32
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论