Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Jetty ALPN/NPN has not been properly configured. #2483

Closed
qorpus opened this issue Oct 5, 2017 · 18 comments
Closed

Error: Jetty ALPN/NPN has not been properly configured. #2483

qorpus opened this issue Oct 5, 2017 · 18 comments
Assignees
Labels
api: logging Issues related to the Cloud Logging API. type: question Request for information or clarification. Not an issue.

Comments

@qorpus
Copy link

qorpus commented Oct 5, 2017

Related to #2266 - but is not resolved by anything in there either.

Stack trace

com.google.cloud.logging.LoggingException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly
configured.
1419         at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:66)
1420         at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:58)
1421         at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:472)
1422         at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:134)
1423         at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:108)
1424         at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
1425         at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
1426         at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:459)
1427         at com.myproject.framework.logger.StackdriverAppender.<init>(StackdriverAppender.java:49)
1428         at com.myproject.framework.utils.LoggerControl.addStackdriverAppender(LoggerControl.java:131)
1429         at com.myproject.framework.config.CoreInitializer.initialize(CoreInitializer.java:510)
1430         at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635)
1431         at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349)
1432         at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
1433         at com.myproject.framework.configserver.StartConfigServer.main(StartConfigServer.java:45)
1434         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
1435         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
1436         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
1437         at java.lang.reflect.Method.invoke(Method.java:498)
1438         at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
1439         at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
1440         at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
1441         at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
1442 Caused by: java.io.IOException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly
configured.
1443         at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:141)
1444         at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:64)
1445         ... 22 common frames omitted
1446 Caused by: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
1447         at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:159)
1448         at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:136)
1449         at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:124)
1450         at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:94)
1451         at
io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:525)
1452         at
io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:518)
1453         at io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:457)
1454         at io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:326)
1455         at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:315)
1456         at
com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:131)
1457         at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:116)
1458         at com.google.api.gax.grpc.GrpcTransportProvider.getTransport(GrpcTransportProvider.java:98)
1459         at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:112)
1460         ... 23 common frames omitted

compatibility tool output.

OS details:
  os.detected.name: linux
  os.detected.arch: x86_64
  os.detected.classifier: linux-x86_64
  os.detected.release: ubuntu
  os.detected.release.version: 17.04
JVM details:
  Java version: 1.8.0_131
  Java specification version: 1.8
  JVM bit mode: 64
OpenSSL details:
  open ssl is available: true
  ALPN is supported: true
Checking compatibility...
  [PASS] This OS + architecture is supported.
  [PASS] 64-bit JVM is supported.
  [PASS] Open SSL is available
  [PASS] Open SSL ALPN is supported
Result: UNKNOWN (checker implementation not complete)
  Based on what was checked, nothing was identified that would
  prevent you from using grpc-based APIs.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.933 s
[INFO] Finished at: 2017-09-27T18:21:20+00:00
[INFO] Final Memory: 17M/470M
[INFO] ------------------------------------------------------------------------

@qorpus
Copy link
Author

qorpus commented Oct 5, 2017

Happy to provide whatever other info is required.

@qorpus
Copy link
Author

qorpus commented Oct 5, 2017

tree.txt

attached the maven dep tree, might provide some clarity.

@qorpus
Copy link
Author

qorpus commented Oct 5, 2017

forcing 2.0.5.Final or 2.0.6.Final of netty-tcnative-boringssl-static has no change either.

       <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-logging</artifactId>
            <version>${google.cloud.apis}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-tcnative-boringssl-static</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative-boringssl-static</artifactId>
            <version>2.0.6.Final</version>
        </dependency>

@qorpus
Copy link
Author

qorpus commented Oct 5, 2017

also ensuring that it has the correct classifier for boringssl-static has no affect.

        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-logging</artifactId>
            <version>${google.cloud.apis}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-tcnative-boringssl-static</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative-boringssl-static</artifactId>
            <version>2.0.6.Final</version>
            <classifier>linux-x86_64</classifier>
        </dependency>

@pongad
Copy link
Contributor

pongad commented Oct 6, 2017

Hmm! I tried this locally in a new Maven project:

  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-logging</artifactId>
      <version>1.7.0</version>
    </dependency>
  </dependencies>

and was able to make a call to create metrics.

@qorpus Could you try creating a new Maven project to test? The code I used to test is this:

    LoggingOptions options = LoggingOptions.getDefaultInstance();
    try (Logging logging = options.getService()) {
      MetricInfo metricInfo =
          MetricInfo.newBuilder("test-metric", "severity >= ERROR")
              .setDescription("Log entries with severity higher or equal to ERROR")
              .build();
      logging.create(metricInfo);
    }

Are you using Tomcat or anything like that?

@pongad pongad added type: question Request for information or clarification. Not an issue. api: logging Issues related to the Cloud Logging API. labels Oct 6, 2017
@jabubake
Copy link
Contributor

jabubake commented Oct 6, 2017

@qorpus : have you set authorization credentials either using gcloud auth application-default login if running locally or using GOOGLE_APPLICATION_CREDENTIALS env var ?

@qorpus
Copy link
Author

qorpus commented Oct 11, 2017

@jabubake - yeah that all seems fine, because if we roll back to 1.1.0 env it works correctly!

@jabubake
Copy link
Contributor

vertx brings in an older version of netty, and possibly causing your issue, can you try adding
a dependencyManagement section ?

 <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-handler</artifactId>
        <version>4.1.14.Final</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

Looking at your dependency tree, likely you need to manage your guava version.

@qorpus
Copy link
Author

qorpus commented Oct 11, 2017

@jabubake - tried that out, added in a raft of depManagement for netty packages, but alas no luck

017-10-11 15:01:11,828 ERROR []-[] [main] o.c.r.u.LoggerControl - Could not append stackdriver appender
com.google.cloud.logging.LoggingException: java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:66)
	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:58)
	at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:472)
	at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:134)
	at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:108)
	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
	at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:459)
	at com.google.cloud.logging.logback.LoggingAppender.getLogging(LoggingAppender.java:201)
	at com.google.cloud.logging.logback.LoggingAppender.start(LoggingAppender.java:166)

@qorpus
Copy link
Author

qorpus commented Oct 11, 2017

@pongad - not using tomcat, we are using Apache Ignite and Springboot though.

Will try out your suggestion and post results.

@qorpus
Copy link
Author

qorpus commented Oct 11, 2017

@pongad - that worked fine, so clearly I am having some dependency conflicts.

@lesv
Copy link
Contributor

lesv commented Oct 20, 2017

grpc/grpc-java#3025 is probably the canonical issue for this.

@pongad
Copy link
Contributor

pongad commented Nov 9, 2017

I agree with @lesv . I'll close this as duplicate. Please reopen if required, though I believe this is a problem more fit for gRPC, not this repo.

@pongad pongad closed this as completed Nov 9, 2017
@saturnism
Copy link

For those that landed on this issue from search, please see gRPC troubleshooting guide https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting

@sebasao
Copy link

sebasao commented Feb 4, 2018

I ran into the same error. Following previous Troubleshooting guide, indeed I had a dependency conflict. As the io.netty library was imported by another maven artefact not related to google. So I disabled temporarily the oldest one and left only the google cloud one. It all worked fine afterwards.

@pongad
Copy link
Contributor

pongad commented Feb 5, 2018

An update: We have a PR to shade netty. Hopefully this means the problem will go away the next release.

@ashvinikumar-1
Copy link

I am using google-cloud-vision version 1.32.0 with Java 8. It works fine in mac however when I tried on Linux with same Java 8, I am getting exception
java.lang.IllegalArgumentException: ALPN is not configured properly. See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting for more information.
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:166)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:136)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:124)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:94)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.(NettyChannelBuilder.java:546)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.(NettyChannelBuilder.java:539)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.(NettyChannelBuilder.java:477)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:325)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:362)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:206)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151)
at com.google.cloud.vision.v1.stub.GrpcImageAnnotatorStub.create(GrpcImageAnnotatorStub.java:84)
at com.google.cloud.vision.v1.stub.ImageAnnotatorStubSettings.createStub(ImageAnnotatorStubSettings.java:120)
at com.google.cloud.vision.v1.ImageAnnotatorClient.(ImageAnnotatorClient.java:136)
at com.google.cloud.vision.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:117)
at com.hp.wex.utilities.FileDirStringOp.getOcrText(FileDirStringOp.java:250)
at com.hp.wex.MainApp.main(MainApp.java:203)
Caused by: java.lang.ClassNotFoundException: org/eclipse/jetty/alpn/ALPN
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.grpc.netty.shaded.io.grpc.netty.JettyTlsUtil.isJettyAlpnConfigured(JettyTlsUtil.java:64)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:153)
... 18 more
can any one help me out with this??

@lesv
Copy link
Contributor

lesv commented Oct 22, 2018

Which version of Linux? 32/64 bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

7 participants