aws / aws-iot-device-sdk-java-v2

Next generation AWS IoT Client SDK for Java using the AWS Common Runtime
Apache License 2.0
119 stars 75 forks source link

Trying to use Greengrass sample #51

Closed adelgadorioja closed 4 years ago

adelgadorioja commented 4 years ago

Confirm by changing [ ] to [x] below:

Platform/OS/Hardware/Device IOS: Debian 9 Java: Openjdk version "1.8.0_242" Maven: Apache Maven 3.3.9

Describe the question Hi guys,

I'm trying to use Greengrass sample following this guide (the arguments change from the python version to the java version).

When I run the following command: mvn exec:java -pl samples/Greengrass -Dexec.mainClass=greengrass.BasicDiscovery -Dexec.args='--region us-east-1 --rootca /path/root-ca-cert.pem --cert /path/hash-certificate.pem.crt --key /path/hash-private.pem.key --thingName test-device --topic "hello/world/pubsub" --mode publish'

This error appears:

Exception thrown: software.amazon.awssdk.crt.CrtRuntimeException: TlsContext.tls_ctx_new: Failed to create new aws_tls_ctx (aws_last_error: AWS_IO_TLS_CTX_ERROR(1033), Failed to create tls context ) software.amazon.awssdk.crt.CrtRuntimeException: TlsContext.tls_ctx_new: Failed to create new aws_tls_ctx (aws_last_error: AWS_IO_TLS_CTX_ERROR(1033), Failed to create tls context) at software.amazon.awssdk.crt.io.TlsContext.tlsContextNew(Native Method) at software.amazon.awssdk.crt.io.TlsContext.(TlsContext.java:34) at software.amazon.awssdk.iot.discovery.DiscoveryClientConfig.(DiscoveryClientConfig.java:25) at greengrass.BasicDiscovery.main(BasicDiscovery.java:174) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282) at java.lang.Thread.run(Thread.java:748)

Any idea why this might be happening?

Thank you all.

DavidOgunsAWS commented 4 years ago

Álvaro,

Can you please provide a crt log by adding the command line args: like the following -Daws.crt.log.destination=File -Daws.crt.log.level=Trace -Daws.crt.log.filename=basic_discovery.log

Feel free to pick a different filename path for the log file. It is unlikely that you need to specify the root CA, but I am not suggesting that is causing the error you're seeing.