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: Invalid or corrupt jarfile DynamoDBLocal.jar #30

Open
jamesmorgan opened this issue May 29, 2019 · 14 comments
Open

Error: Invalid or corrupt jarfile DynamoDBLocal.jar #30

jamesmorgan opened this issue May 29, 2019 · 14 comments

Comments

@jamesmorgan
Copy link

jamesmorgan commented May 29, 2019

I have a fairly simple test but when I try to use the package I get a corruption error, any ideas?

Sample code below:

const chai = require('chai');
chai.should();

const AWS = require('../../src/services/aws');

const DynamoDbLocal = require('dynamodb-local');
const dynamoLocalPort = 8000;

// optional config customization - default is your OS' temp directory and an Amazon server from US West
DynamoDbLocal.configureInstaller({
    installPath: './dynamodblocal-bin',
});

const VenuesService = require('../../src/services/venues.service');

describe.only('Venues Service test', () => {

    before(async () => {
        this.venuesService = new VenuesService(AWS);
        this.child = await DynamoDbLocal.launch(dynamoLocalPort, null, [], false, true);
        console.log(`Started Local DynamoDB - PID [${this.child.pid}]`);
    });

    after(async () => {
        await DynamoDbLocal.stopChild(this.child);
    });

    describe('a test', () => {
        it('should pass', async () => {
                const exampleVenue = require('../data/dummy_venue');
                await this.venuesService.createVenue(exampleVenue);
                done();
        });
    });

});

I see it downloading the jar to ./dynamodblocal-bin

Any ideas on this, what am I missing?

thanks in advance

@praisegeek
Copy link

Delete the folder .dynamodb on your project root folder then run sls dynamodb install again to download dependencies. Ensure it gets to 100%.

@rfoel
Copy link

rfoel commented Jun 25, 2020

Had the same problem on mac os. Reinstalling Java fixed for me.

@AlessandroVol23
Copy link

I have the same problem on Mac OS as well. I tried the current jdk and jdk version 8. Reinstalling didn't help. Any suggestions?

@AlessandroVol23
Copy link

Works with sudo yarn test. Sorry!

Do you know where the .DynamoDBLocal.jar file gets downloaded to?

@djorg83
Copy link

djorg83 commented Sep 4, 2020

I found the dynamodblocal installed in $TMPDIR

@AlessandroVol23
Copy link

I found the dynamodblocal installed in $TMPDIR

Okay, I can't find it in there unfortunately. With sudo I can't watch the tests, so I'd like to change the access rights of the .DynamoDBLocal file but can't find it.

@AlessandroVol23
Copy link

Okay it works now without sudo. No idea why, thanks anyway! :-)

@Davidislit
Copy link

I'm also encountered with this issue and this is the procedure I've done to solve it:

  1. download the jar manually (the url is from the package) https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz
  2. unzipped the tar file to the PATH: os.tmpdir() (you can simple execute this function in a simple script or via node cli)
  3. Changed the folder name to dynamodb-local
  4. sudo chmod 777 ./DynamoDBLocal.jar (the Jar is inside the folder)

This fixed my issue on my local machine.

@emxqm-11
Copy link

emxqm-11 commented Oct 7, 2020

@Davidislit
Thanks that works. Originally i used sls dynamodb install but realised that /DynamoDBLocal_lib was completely empty and so was /third_party_licenses. I then downloaded the jar manually from your link. Copied the extracted contents into my project's /.dynomodb , sudo chmod the .jar and its running now.

@visheshd
Copy link

Using this on a private library without serverless ... I am on macOS Big Sur ... none of the workarounds work. Throws the same error.

@sudarshan-plus
Copy link

I guess it's an issue of the cloud region/zone, most probably.

@johnou
Copy link

johnou commented Mar 20, 2024

%temp%\dynamodb-local on windows.

@pablo-albaladejo
Copy link

I solved the problem by deleting the directory /tmp/dynamodb-local on Linux
For other operating systems, it's the one defined at https://github.com/rynop/dynamodb-local/blob/master/index.js#L17

@zhaoyi0113
Copy link

I am facing the same issue on Mac. Where should I put the jar file?

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