serverless-dynamodb-local icon indicating copy to clipboard operation
serverless-dynamodb-local copied to clipboard

"Dynamodb start" missing log4j/logger - exception

Open jurosh opened this issue 8 years ago • 6 comments

Console output:

>sls dynamodb start
Dynamodb Local Started, Visit: http://localhost:8000/shell

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer.<clinit>(DynamoDBProxyServer.java:36)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServer(ServerRunner.java:123)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServerFromCommandLineArgs(ServerRunner.java:119)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.main(ServerRunner.java:70)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 4 more
DynamoDB Local failed to start with code 1

Versions:

>sls --v
1.5.1

>java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

>node -v
v7.2.0

Package.json:

   "serverless-dynamodb-local": "^0.2.16",
    "serverless-offline": "^3.8.3"

serverless.yaml

service: aws-nodejs-nexit

provider:
  name: aws
  runtime: nodejs4.3
functions:
  hello:
    handler: src/handler.hello
    events:
      - http:
          path: hello
          method: get
plugins:
  - serverless-offline
  - serverless-dynamodb-local

custom:
  dynamodb:
    start:
      port: 8000
      inMemory: true
      migration: true
    migration:
      dir: ./offline/migrations

jurosh avatar Jan 29 '17 10:01 jurosh

Hi @jurosh . Sorry for the late reply. Will you be able to verify following process work? Setting up dynamodb local directly

AshanFernando avatar Feb 03 '17 10:02 AshanFernando

In meanwhile I am running database in Docker, without any issues. But I may try this later.

jurosh avatar Feb 03 '17 11:02 jurosh

@AshanFernando seems yes, no error when running jar from site.

>java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Initializing DynamoDB Local with the following configuration:
Port:   8000
InMemory:       false
DbPath: null
SharedDb:       true
shouldDelayTransientStatuses:   false
CorsParams:     *

jurosh avatar Apr 08 '17 17:04 jurosh

Happens to me as well. Looks like the problem with interrupted install process. This can easily happen due to low jasmine.DEFAULT_TIMEOUT_INTERVAL + installing dynamodb right before the tests. Increasing of jasmine.DEFAULT_TIMEOUT_INTERVAL helps.

bleshik avatar Jun 14 '17 21:06 bleshik

@AshanFernando seems yes, no error when running jar from site.

>java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Initializing DynamoDB Local with the following configuration:
Port:   8000
InMemory:       false
DbPath: null
SharedDb:       true
shouldDelayTransientStatuses:   false
CorsParams:     *

No sense of testing the jar from the aws site, instead, you should test with your local dynamoLocal.jar in the dir .dynamodb of the serverless project home.

Test against with "java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb" to see what happens.

Probably this issue is caused by an interrupted download and worse still, when you re-run sls dynamodb install, it will remind you that "Dynamodb is already installed on path!" even it's a broken jar.

Prune that dir and run "sls dynamodb install" again! Hope that helps

whossa avatar Aug 09 '19 11:08 whossa

@AshanFernando seems yes, no error when running jar from site.

>java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Initializing DynamoDB Local with the following configuration:
Port:   8000
InMemory:       false
DbPath: null
SharedDb:       true
shouldDelayTransientStatuses:   false
CorsParams:     *

No sense of testing the jar from the aws site, instead, you should test with your local dynamoLocal.jar in the dir .dynamodb of the serverless project home.

Test against with "java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb" to see what happens.

Probably this issue is caused by an interrupted download and worse still, when you re-run sls dynamodb install, it will remind you that "Dynamodb is already installed on path!" even it's a broken jar.

Prune that dir and run "sls dynamodb install" again! Hope that helps

Thank you

asotjrs avatar Mar 30 '21 00:03 asotjrs