awslabs / amazon-kinesis-producer

Amazon Kinesis Producer Library
Apache License 2.0
402 stars 331 forks source link

kinesis.producer.HashedFileCopier : Unable to delete temp file: C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries\kpl4220697395646439365.tmp #348

Open satyarajp opened 3 years ago

satyarajp commented 3 years ago

Trying to write POC with KinesisProducer

Dependency in Gradle + Spring: implementation group: 'com.amazonaws', name: 'amazon-kinesis-producer', version: '0.14.6'

    public void sendProducerMessage() {     
        BasicAWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey);
        KinesisProducerConfiguration kpConf = new KinesisProducerConfiguration();
        kpConf.setCredentialsProvider(new AWSStaticCredentialsProvider(creds));
        kpConf.setRegion(Regions.AP_SOUTH_1.getName());
        kpConf.setVerifyCertificate(false);     
        KinesisProducer kp = new  KinesisProducer(kpConf); // Error here
        kp.addUserRecord("sunnxt-kb-kinesis", "userEntry", ByteBuffer.wrap(payload.getBytes()));
    }

Log File:

2021-03-16 19:57:35.645  INFO 2268 --- [nio-8080-exec-1] c.a.s.kinesis.producer.KinesisProducer   : Extracting binaries to C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries
2021-03-16 19:57:35.666  WARN 2268 --- [nio-8080-exec-1] c.a.s.kinesis.producer.HashedFileCopier  : Unable to delete temp file: C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries\kpl4220697395646439365.tmp
2021-03-16 19:57:35.701 ERROR 2268 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Could not copy native binaries to temp directory C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries] with root cause

java.lang.NullPointerException: null
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792) ~[commons-io-2.4.jar:2.4]
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769) ~[commons-io-2.4.jar:2.4]
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744) ~[commons-io-2.4.jar:2.4]
    at com.amazonaws.services.kinesis.producer.HashedFileCopier.copyFileFrom(HashedFileCopier.java:52) ~[amazon-kinesis-producer-0.14.6.jar:na]
    at com.amazonaws.services.kinesis.producer.KinesisProducer.extractBinaries(KinesisProducer.java:1025) ~[amazon-kinesis-producer-0.14.6.jar:na]
    at com.amazonaws.services.kinesis.producer.KinesisProducer.<init>(KinesisProducer.java:298) ~[amazon-kinesis-producer-0.14.6.jar:na]
    at com.aws.poc.Kinesis.KinesisController.sendProducerMessage(KinesisController.java:56) ~[main/:na]
maheshkg-acc commented 3 years ago

i am also seeing the same error, when running the kinesis producer in the windows application. However same application is running in the linux system.

2021-03-24 21:57:24.899 INFO 13780 --- [ main] c.a.s.kinesis.producer.KinesisProducer : Extracting binaries to C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries 2021-03-24 21:57:24.938 WARN 13780 --- [ main] c.a.s.kinesis.producer.HashedFileCopier : Unable to delete temp file: C:\Users\user\AppData\Local\Temp\amazon-kinesis-producer-native-binaries\kpl8412155204827919467.tmp java.lang.RuntimeException: Could not copy native binaries to temp directory C:\Users\username\AppData\Local\Temp\amazon-kinesis-producer-native-binaries at com.amazonaws.services.kinesis.producer.KinesisProducer.extractBinaries(KinesisProducer.java:1039) at com.amazonaws.services.kinesis.producer.KinesisProducer.(KinesisProducer.java:298) at com.kinesis.producer.SampleProducer.mainTest(SampleProducer.java:88) at com.kinesis.producer.DemoApplication.main(DemoApplication.java:30) Caused by: java.lang.NullPointerException at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792)

nleytem commented 3 years ago

Windows support was dropped in version 0.14.0.