elasticsearchgrailsmicronautmicronaut-rest

Grails with micronaut-elasticsearch plugin


I am migrating a project form grails 3.0.3 and elasticsearch 1.7.3 to grails 4.0.4 and elasticsearch 7.13.

Unfortunately, the elasticsearch-groovy-plugin is not actively maintained and it seems, that the best option is to switch to micronaut-elasticsearch.

To test this option, I've created a new grails 4.0.4 application and added

compile 'io.micronaut.elasticsearch:micronaut-elasticsearch:2.3.0'

to the gradle.build file. Unfortunately I get the following error:

| Error Failed to compile CreateFunctionalTest.groovy: Error loading service [io.micronaut.validation.validator.DefaultAnnotatedElementValidator]: Error loading BeanIntrospection for type [class io.micronaut.validation.validator.constraints.DefaultConstraintValidators]: 'void io.micronaut.core.beans.AbstractBeanIntrospection.<init>(java.lang.Class, io.micronaut.core.annotation.AnnotationMetadata, int, int)' (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.util.ServiceConfigurationError: Error loading service [io.micronaut.validation.validator.DefaultAnnotatedElementValidator]: Error loading BeanIntrospection for type [class io.micronaut.validation.validator.constraints.DefaultConstraintValidators]: 'void io.micronaut.core.beans.AbstractBeanIntrospection.<init>(java.lang.Class, io.micronaut.core.annotation.AnnotationMetadata, int, int)'
    at io.micronaut.core.io.service.DefaultServiceDefinition.lambda$load$0(DefaultServiceDefinition.java:71)
    at io.micronaut.core.io.service.DefaultServiceDefinition.load(DefaultServiceDefinition.java:67)
    at io.micronaut.ast.groovy.annotation.GroovyAnnotationMetadataBuilder.<init>(GroovyAnnotationMetadataBuilder.groovy:90)
    at io.micronaut.ast.groovy.utils.AstAnnotationUtils$_getAnnotationMetadata_closure1.doCall(AstAnnotationUtils.groovy:54)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at com.sun.proxy.$Proxy20.apply(Unknown Source)
    at io.micronaut.core.util.clhm.ConcurrentLinkedHashMap.lambda$compute$0(ConcurrentLinkedHashMap.java:721)
    at io.micronaut.core.util.clhm.ConcurrentLinkedHashMap.compute(ConcurrentLinkedHashMap.java:733)
    at io.micronaut.core.util.clhm.ConcurrentLinkedHashMap.computeIfAbsent(ConcurrentLinkedHashMap.java:710)
    at io.micronaut.ast.groovy.utils.AstAnnotationUtils.getAnnotationMetadata(AstAnnotationUtils.groovy:53)
    at io.micronaut.ast.groovy.TypeElementVisitorTransform.visit(TypeElementVisitorTransform.groovy:83)
    at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.readCommandFile(GroovyScriptCommandFactory.groovy:50)
    at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.readCommandFile(GroovyScriptCommandFactory.groovy)
    at org.grails.cli.profile.commands.factory.ResourceResolvingCommandFactory.findCommands(ResourceResolvingCommandFactory.groovy:44)
    at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy:86)
    at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy)
    at org.grails.cli.profile.AbstractProfile.getCommands(AbstractProfile.groovy:439)
    at org.grails.cli.profile.repository.AbstractJarProfileRepository$JarProfile.getCommands(AbstractJarProfileRepository.groovy:130)
    at org.grails.cli.profile.AbstractProfile.getCompleters(AbstractProfile.groovy:369)
    at org.grails.cli.GrailsCli.setupCompleters(GrailsCli.groovy:420)
    at org.grails.cli.GrailsCli.handleInteractiveMode(GrailsCli.groovy:402)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:273)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)
Caused by: io.micronaut.core.beans.exceptions.IntrospectionException: Error loading BeanIntrospection for type [class io.micronaut.validation.validator.constraints.DefaultConstraintValidators]: 'void io.micronaut.core.beans.AbstractBeanIntrospection.<init>(java.lang.Class, io.micronaut.core.annotation.AnnotationMetadata, int, int)'
    at io.micronaut.core.beans.DefaultBeanIntrospector.findIntrospection(DefaultBeanIntrospector.java:80)
    at io.micronaut.core.beans.BeanWrapper.findWrapper(BeanWrapper.java:240)
    at io.micronaut.validation.validator.constraints.DefaultConstraintValidators.<init>(DefaultConstraintValidators.java:335)
    at io.micronaut.validation.validator.constraints.DefaultConstraintValidators.<init>(DefaultConstraintValidators.java:324)
    at io.micronaut.validation.validator.DefaultAnnotatedElementValidator$LocalConstraintValidators.<init>(DefaultAnnotatedElementValidator.java:56)
    at io.micronaut.validation.validator.DefaultAnnotatedElementValidator$LocalConstraintValidators.<init>(DefaultAnnotatedElementValidator.java:56)
    at io.micronaut.validation.validator.DefaultAnnotatedElementValidator.<init>(DefaultAnnotatedElementValidator.java:49)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at io.micronaut.core.io.service.DefaultServiceDefinition.lambda$load$0(DefaultServiceDefinition.java:69)
    ... 24 more
Caused by: java.lang.NoSuchMethodError: 'void io.micronaut.core.beans.AbstractBeanIntrospection.<init>(java.lang.Class, io.micronaut.core.annotation.AnnotationMetadata, int, int)'
    at io.micronaut.validation.validator.constraints.$DefaultConstraintValidators$Introspection.<init>(Unknown Source)
    at io.micronaut.validation.validator.constraints.$DefaultConstraintValidators$IntrospectionRef.load(Unknown Source)
    at io.micronaut.core.beans.DefaultBeanIntrospector.lambda$findIntrospection$0(DefaultBeanIntrospector.java:71)
    at io.micronaut.core.beans.DefaultBeanIntrospector.findIntrospection(DefaultBeanIntrospector.java:67)
    ... 34 more
| Error Failed to compile CreateFunctionalTest.groovy: Error loading service [io.micronaut.validation.validator.DefaultAnnotatedElementValidator]: Error loading BeanIntrospection for type [class io.micronaut.validation.validator.constraints.DefaultConstraintValidators]: 'void io.micronaut.core.beans.AbstractBeanIntrospection.<init>(java.lang.Class, io.micronaut.core.annotation.AnnotationMetadata, int, int)'
| Error Error occurred running Grails CLI: null (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NullPointerException
    at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.createCommand(GroovyScriptCommandFactory.groovy:85)
    at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.createCommand(GroovyScriptCommandFactory.groovy)
    at org.grails.cli.profile.commands.factory.ResourceResolvingCommandFactory.findCommands(ResourceResolvingCommandFactory.groovy:46)
    at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy:86)
    at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy)
    at org.grails.cli.profile.AbstractProfile.getCommands(AbstractProfile.groovy:439)
    at org.grails.cli.profile.repository.AbstractJarProfileRepository$JarProfile.getCommands(AbstractJarProfileRepository.groovy:130)
    at org.grails.cli.profile.AbstractProfile.getCompleters(AbstractProfile.groovy:369)
    at org.grails.cli.GrailsCli.setupCompleters(GrailsCli.groovy:420)
    at org.grails.cli.GrailsCli.handleInteractiveMode(GrailsCli.groovy:402)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:273)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)
| Error Error occurred running Grails CLI: null

Do I miss something here?


Solution

  • micronaut-elasticsearch is not a part of grails-bom. So you have to specify a version of the dependency.

    compile 'io.micronaut.elasticsearch:micronaut-elasticsearch:2.3.0'
    

    https://mvnrepository.com/artifact/io.micronaut.elasticsearch/micronaut-elasticsearch