question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatible with AWS SDK 1.11.36 (Null Pointer Exception)

See original GitHub issue

A null pointer exception is being thrown by some dynamically generated queries. I believe the root cause of the problem is that the return types for some queries have changed. See the release notes below for details.

Compatibility with the latest version is required for the DynamoDBTypedConverted annotation fixes and updates.

Release Notes: https://aws.amazon.com/releasenotes/4268484867346012

java.lang.NullPointerException
    at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories.rulesOf(StandardModelFactories.java:146)
    at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories.access$100(StandardModelFactories.java:53)
    at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories$ConversionSchemaFactory.getModelFactory(StandardModelFactories.java:80)
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.getTableModel(DynamoDBMapper.java:392)
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.toParameters(DynamoDBMapper.java:1946)
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.toParameters(DynamoDBMapper.java:1935)
    at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.toParameters(DynamoDBMapper.java:1965)
    at com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList.<init>(PaginatedQueryList.java:66)
    at org.socialsignin.spring.data.dynamodb.core.DynamoDBTemplate.query(DynamoDBTemplate.java:191)
    at org.socialsignin.spring.data.dynamodb.query.MultipleEntityQueryRequestQuery.getResultList(MultipleEntityQueryRequestQuery.java:38)
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQuery$CollectionExecution.execute(AbstractDynamoDBQuery.java:103)
    at org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQuery.execute(AbstractDynamoDBQuery.java:288)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy153.findBy<redacted>(Unknown Source)
    at com.<redacted>.api.repository.dynamo.<redacted>DynamoRepositoryTest.testFindBy<redacted>(<redacted>DynamoRepositoryTest.java:92)
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hb5facommented, Oct 1, 2018

I am using 5.0.2 with Spring-data-dynamodb and the following configuration seems to work around the NPE problem and provided good results:

First I annotated my bean accessor

@EnableDynamoDBRepositories(dynamoDBMapperConfigRef = “getDynamoDBMapperConfig”, basePackages = “my.company.base.package”)

I also setup an environment variable called ENV_PREFIX which is Spring wired via SpEL.

@Value("#{systemProperties['ENV_PREFIX']}")
private String envPrefix;

Then I setup a TableNameOverride bean:

@Bean
public DynamoDBMapperConfig.TableNameOverride getTableNameOverride() {
    return DynamoDBMapperConfig.TableNameOverride.withTableNamePrefix(envPrefix);
}

Finally, I setup the DynamoDBMapperConfig bean using TableNameOverride injection.

@Bean
public DynamoDBMapperConfig getDynamoDBMapperConfig(DynamoDBMapperConfig.TableNameOverride tableNameOverride) {
    DynamoDBMapperConfig.Builder builder = new DynamoDBMapperConfig.Builder();
    builder.setTableNameOverride(tableNameOverride);
    builder.setTypeConverterFactory(DynamoDBTypeConverterFactory.standard());
    return builder.build();
}

In hind sight, I could have setup a DynamoDBTypeConverterFactory bean that returns a standard DynamoDBTypeConverterFactory and inject that into the getDynamoDBMapperConfig() method using the DynamoDBMapperConfig builder. But this will also do the job.

0reactions
data1435commented, Jun 15, 2018

When are you planning to release version 5.0.3?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the error "FAILED: NullPointerException Name is null ...
I get the "FAILED: NullPointerException Name is Null" error when I query my Amazon Athena table. Short description. You get this error when...
Read more >
TLS 1.3 Incompatibility with AWS SDK for Java versions 1.9.5 ...
This blog is to notify you that older versions of the AWS SDK for Java, 1.9.5 to 1.10.31, are incompatible with TLS 1.3....
Read more >
The AWS SDK for Java version 1.12 upgrades its dependency ...
We are raising the minor version of AWS SDK for Java from 1.11 to 1.12 in order to upgrade the SDK's dependency on...
Read more >
AWS SDK for Java | AWS Developer Tools Blog
Customers have told us that they want improved performance and consistency when updating table records. The […] TLS 1.3 Incompatibility with AWS ......
Read more >
IncompatibleTypeException (AWS SDK for Java - 1.12.362)
public class IncompatibleTypeException extends SdkClientException. Thrown upon incompatible type during data conversion. See Also: Serialized Form ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found