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

org.apache.dubbo.config.spring6.utils.AotUtils NullPointerException #13670

Closed
imgoby opened this issue Jan 16, 2024 · 4 comments · Fixed by #13825
Closed

org.apache.dubbo.config.spring6.utils.AotUtils NullPointerException #13670

imgoby opened this issue Jan 16, 2024 · 4 comments · Fixed by #13825
Labels
type/bug Bugs to being fixed

Comments

@imgoby
Copy link

imgoby commented Jan 16, 2024

image

if field's registerType is interface java.io.Serializable, there is an Exception.

dubbo version: <dubbo.version>3.3.0-beta.1</dubbo.version>
native-image builds it.
What causes it?


21:49:45.601 logback [main] INFO  o.s.c.s.binder.DefaultBinderFactory - Pre-creating binder child context (AOT) for rocketmq
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.Class.isPrimitive()" because "cls" is null
	at org.apache.dubbo.config.spring6.utils.AotUtils.isPrimitive(AotUtils.java:59)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:44)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:52)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationType$2(AotUtils.java:50)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:50)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationForService$1(AotUtils.java:39)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationForService(AotUtils.java:36)
	at org.apache.dubbo.config.spring6.beans.factory.annotation.ReferenceAnnotationWithAotBeanPostProcessor$AotContribution.generateMethodStatementForElement(ReferenceAnnotationWithAotBeanPostProcessor.java:256)
	at org.apache.dubbo.config.spring6.beans.factory.annotation.ReferenceAnnotationWithAotBeanPostProcessor$AotContribution.generateMethodCode(ReferenceAnnotationWithAotBeanPostProcessor.java:233)
	at org.apache.dubbo.config.spring6.beans.factory.annotation.ReferenceAnnotationWithAotBeanPostProcessor$AotContribution.lambda$applyTo$1(ReferenceAnnotationWithAotBeanPostProcessor.java:219)
	at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
	at org.apache.dubbo.config.spring6.beans.factory.annotation.ReferenceAnnotationWithAotBeanPostProcessor$AotContribution.applyTo(ReferenceAnnotationWithAotBeanPostProcessor.java:212)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.lambda$generateBeanDefinitionMethod$2(BeanDefinitionMethodGenerator.java:186)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:186)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:109)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:93)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:91)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:76)
	at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
	at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:75)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
	at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
	at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
	at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
	at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
	at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
	at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)

demo is here:
https://github.com/imgoby/spring-cloud-alibaba-dubbo-native/tree/main/dubbo-samples-spring-boot-provider

@imgoby imgoby added the type/need-triage Need maintainers to triage label Jan 16, 2024
@imgoby
Copy link
Author

imgoby commented Jan 17, 2024

@CrazyHZM

@imgoby
Copy link
Author

imgoby commented Jan 18, 2024

image

This judgment seems to be acceptable

@imgoby
Copy link
Author

imgoby commented Jan 22, 2024

@CrazyHZM
when parameter's type is java.io.Serializable,it compile failed.

public interface DemoService{


    String sayHello(java.io.Serializable name);
}

@imgoby
Copy link
Author

imgoby commented Mar 4, 2024

@CrazyHZM bug exists while type is java.io.Serializable.

@CrazyHZM CrazyHZM added type/bug Bugs to being fixed and removed type/need-triage Need maintainers to triage labels Mar 4, 2024
@CrazyHZM CrazyHZM linked a pull request Mar 4, 2024 that will close this issue
8 tasks
@AlbumenJ AlbumenJ closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants