2

For a trivial app using CDI in Java SE with jakarta namespace I can not get rid of this NoSuchMethodError during SeContainerInitializer.newInstance().initialize():

Caused by: java.lang.NoSuchMethodError: 'java.util.Map org.jboss.jandex.ClassInfo.annotationsMap()'

I guess I'm missing dependencies. Shouldn't this be sufficient?

        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se-shaded</artifactId>
            <version>5.1.0.Final</version>
        </dependency>

beans.xml is in place at src/main/resources/META-INF

r-uu
  • 423
  • 1
  • 4
  • 18

1 Answers1

1

The solution that works for me is to exclude jandex from hibernate dependency and to add an individual jandex dependency to the project. Here is an excerpt from my pom.xml:

            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core-jakarta</artifactId>
                <version>5.6.14.Final</version>
                <exclusions>
                    <!-- without exclusion of jandex in hibernate a no such method error is raised -->
                    <!-- with    exclusion an explicit dependency to jandex is needed (see below)  -->
                    <!-- note that jandex is referenced with groupId io.smallrye actually          -->
                    <exclusion>
                        <groupId>org.jboss</groupId>
                        <artifactId>jandex</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <!-- individual dependency to jandex to accomplish necessary exclusion of jandex in -->
            <!-- hibernate-core-jakarta (see above)                                             -->
            <dependency>
                <groupId>io.smallrye</groupId>
                <artifactId>jandex</artifactId>
                <version>3.0.5</version>
            </dependency>
r-uu
  • 423
  • 1
  • 4
  • 18