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

Event Stream starter application failed to load SSL keystore truststore.p12 due to "parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)" error #239

Open
falixchong opened this issue Dec 23, 2021 · 1 comment

Comments

@falixchong
Copy link

falixchong commented Dec 23, 2021

Bug

Issue Summary

Trying out CP4I Event Stream starter application.
Been getting parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48) error when running demo-all.jar with the generated properties from the starter application.

Access event stream starter application via Toolbox -> Starter Application -> Get Started

  • screenshot here
    image
    image

Environment

  • OS: Macos 12.0.1
  • OCP version 4.8.21
  • CP4I version 2021.3
  • IBM Event Stream version 10.4.0
  • Event Stream Starter Application 1.1.3
  • java jdk version
    openjdk version "1.8.0_282"
    OpenJDK Runtime Environment (build 1.8.0_282-bre_2021_01_20_16_06-b00)
    OpenJDK 64-Bit Server VM (build 25.282-b00, mixed mode)

How To Reproduce This Issue

  1. Download the JAR
    You'll need to go to GitHub and download the latest JAR for the starter application.
    https://github.com/ibm-messaging/kafka-java-vertx-starter/releases

  2. Generate properties file, then download and unzip
    Download and unzip the file which will contain a properties file (containing credentials and configuration) and the certificates the application requires to connect to your chosen Event Streams topic.

  3. Navigate to the JAR file downloaded from GitHub, and run it
    Run the following command replacing with the full filepath to the kafka.properties file and certificates downloaded in step 2

java -Dproperties_path=<path-to-properties> -jar demo-all.jar

Expected Behaviour

Application started in X ms

Relevant Logs

2021-12-23 23:19:34,769 INFO [vert.x-eventloop-thread-0] kafka.vertx.demo.Main - Application version: 1.1.3
2021-12-23 23:19:35,152 INFO [vert.x-eventloop-thread-2] kafka.vertx.demo.WebSocketServer - 🚀 WebSocketServer started
2021-12-23 23:19:35,240 ERROR [vert.x-eventloop-thread-1] io.vertx.core.impl.ContextImpl - Unhandled exception
org.apache.kafka.common.KafkaException: Failed to construct kafka producer
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:441)
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:273)
	at io.vertx.kafka.client.producer.KafkaWriteStream.create(KafkaWriteStream.java:103)
	at io.vertx.kafka.client.producer.KafkaProducer.create(KafkaProducer.java:192)
	at kafka.vertx.demo.PeriodicProducer.setup(PeriodicProducer.java:42)
	at kafka.vertx.demo.PeriodicProducer.lambda$start$0(PeriodicProducer.java:32)
	at io.vertx.core.impl.future.FutureImpl$1.onSuccess(FutureImpl.java:91)
	at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
	at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.CompositeFutureImpl.trySucceed(CompositeFutureImpl.java:163)
	at io.vertx.core.impl.future.CompositeFutureImpl.lambda$all$0(CompositeFutureImpl.java:38)
	at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.SucceededFuture.addListener(SucceededFuture.java:88)
	at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:43)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
	at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
	at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.kafka.common.KafkaException: org.apache.kafka.common.KafkaException: Failed to load SSL keystore /Users/falix/Desktop/es-client1.1.3/test-es_properties/truststore.p12 of type PKCS12
	at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:172)
	at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:157)
	at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:73)
	at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105)
	at org.apache.kafka.clients.producer.KafkaProducer.newSender(KafkaProducer.java:449)
	at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:430)
	... 40 common frames omitted
Caused by: org.apache.kafka.common.KafkaException: Failed to load SSL keystore /Users/falix/Desktop/es-client1.1.3/test-es_properties/truststore.p12 of type PKCS12
	at org.apache.kafka.common.security.ssl.DefaultSslEngineFactory$SecurityStore.load(DefaultSslEngineFactory.java:306)
	at org.apache.kafka.common.security.ssl.DefaultSslEngineFactory$SecurityStore.<init>(DefaultSslEngineFactory.java:285)
	at org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.createTruststore(DefaultSslEngineFactory.java:264)
	at org.apache.kafka.common.security.ssl.DefaultSslEngineFactory.configure(DefaultSslEngineFactory.java:144)
	at org.apache.kafka.common.security.ssl.SslFactory.instantiateSslEngineFactory(SslFactory.java:136)
	at org.apache.kafka.common.security.ssl.SslFactory.configure(SslFactory.java:93)
	at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:168)
	... 45 common frames omitted
Caused by: java.io.IOException: parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)
	at sun.security.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:819)
	at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2027)
	at java.security.KeyStore.load(KeyStore.java:1445)
	at org.apache.kafka.common.security.ssl.DefaultSslEngineFactory$SecurityStore.load(DefaultSslEngineFactory.java:303)
	... 51 common frames omitted
Caused by: java.io.IOException: ObjectIdentifier() -- data isn't an object ID (tag = 48)
	at sun.security.util.ObjectIdentifier.<init>(ObjectIdentifier.java:285)
	at sun.security.util.DerInputStream.getOID(DerInputStream.java:320)
	at com.sun.crypto.provider.PBES2Parameters.engineInit(PBES2Parameters.java:267)
	at java.security.AlgorithmParameters.init(AlgorithmParameters.java:293)
	at sun.security.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:815)
	... 54 common frames omitted```
@falixchong
Copy link
Author

apparently it was cause by java run time version

java jdk version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-bre_2021_01_20_16_06-b00)
OpenJDK 64-Bit Server VM (build 25.282-b00, mixed mode)

I updated my java minor version from 1.8.0_282 to 1.8.0_312 and it works as intended.
image (1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant