I'm writing a Lambda function with Java8 and try to use AWS SDK for Java to access a S3 bucket. 
The AWS Java SDK for S3 is bundled with the java function in version 1.11.510. The function does work on AWS.

When executing the function on localstack the function fails with the following error when trying to access the S3 resource:
```
Exception: Lambda process returned error status code: 1. Output:
Exception in thread "main" java.lang.NoSuchFieldError: SERVICE_ID
        at com.amazonaws.services.s3.AmazonS3Client.createRequest(AmazonS3Client.java:4655)
        at com.amazonaws.services.s3.AmazonS3Client.createRequest(AmazonS3Client.java:4630)
        at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:976)
        at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:984)
        at com.App.handleRequest(App.java:22)
        at cloud.localstack.LambdaExecutor.main(LambdaExecutor.java:100)
```
When checking the class that defines the field `SERVICE_ID` with `HandlerContextKey.class.getProtectionDomain().getCodeSource()` the output is 
`file:/home/user/.local/lib/python2.7/site-packages/localstack/infra/localstack-utils-fat.jar` which is not from the bundled jar file of the Lambda function but from localstacks own jar files.
This results in incompatibilities between different class versions.

Is there a requirement that localstack only works with a specific AWS Java SDK version? If not how can I get the function to work on localstack?

I'm using localstack v0.8.10 on Windows 10 via Windows Subsystem for Linux (WSL) Ubuntu 18.04.1 LTS.

possible duplicate of #952

UPDATE:
After changing the lambda function to use aws-java-sdk v1.11.310 which is the version included in localstack-utils-fat.jar the lambda function executes properly.

This is still an isolation issue that might result in issues with other classes where no easy workaround is available.

One would rather want to load the jar file in it's own classpath (hacky) or apply a proper modularization via OSGi or Java 9 modules (JIGSAW)
def test_run_kcl(self):
        result = []
        def process_records(records):
            result.extend(records)
        
        stream_name = 'test-foobar'
        aws_stack.create_kinesis_stream(stream_name, delete=True)
        kinesis_connector.listen_to_kinesis(
            stream_name=stream_name,
            listener_func=process_records,
            kcl_log_level=logging.INFO,
            wait_until_started=True)
        kinesis = aws_stack.connect_to_service('kinesis')
        stream_summary = kinesis.describe_stream_summary(StreamName=stream_name)
        self.assertEqual(stream_summary['StreamDescriptionSummary']['OpenShardCount'], 1)
        num_events_kinesis = 10
        kinesis.put_records(Records=[
            {
                'Data': '{}',
                'PartitionKey': 'test_%s' % i
            } for i in range(0, num_events_kinesis)
        ], StreamName=stream_name)
        def check_events():
            self.assertEqual(len(result), num_events_kinesis)
        retry(check_events, retries=4, sleep=2)