[Wildfly 27] Errors running builder 'CDI (Contexts and Dependency Injection) Builder' / Jandex

1,333 views
Skip to first unread message

Guillaume G

unread,
Jan 4, 2023, 2:34:13 PM1/4/23
to WildFly

Hello,

I migrate to wildfly 27.0.1 and Java 17 but when i build my projects i get the following error (that i didn't get with previous version of wildfly):

Errors occurred during the build.

Errors running builder 'CDI (Contexts and Dependency Injection) Builder' on project 'XXX'.

Cannot invoke "org.jboss.jandex.ModuleInfo.setPackages(java.util.List)" because the return value of "org.jboss.jandex.ClassInfo.module()" is null

Any suggestions please? i don't know more what to check in my configurations...

If i try to start the wildfly server so i get those errors (for an project):

7:08:49,386 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 80) MSC000001: Failed to start service jboss.persistenceunit."XXX": org.jboss.msc.service.StartException in service jboss.persistenceunit.""XXX": org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not (yet) ready to use  at org.jbos...@27.0.1.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:199)

   at org.jbos...@27.0.1.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:129)

   at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)

   at org.wildfly.secu...@2.0.0.Final//org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:664)

   at org.jbos...@27.0.1.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:214)

   at org.jbos...@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)

   at org.jbos...@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)

   at org.jbos...@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)

   at org.jbos...@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)

   at java.base/java.lang.Thread.run(Thread.java:833)

   at org.jbos...@2.4.0.Final//org.jboss.threads.JBossThread.run(JBossThread.java:513)

Caused by: org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not (yet) ready to use

   at org.hi...@6.1.5.Final//org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy$NamedBeanImpl.initialize(JpaCompliantLifecycleStrategy.java:231)

   at org.hi...@6.1.5.Final//org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl$NamedBeanImpl.initialize(CdiBeanContainerExtendedAccessImpl.java:165)

   at org.hi...@6.1.5.Final//org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl$NamedBeanImpl.getBeanInstance(CdiBeanContainerExtendedAccessImpl.java:172)

   at org.hi...@6.1.5.Final//org.hibernate.resource.beans.internal.ManagedBeanRegistryImpl$ContainedBeanManagedBeanAdapter.getBeanInstance(ManagedBeanRegistryImpl.java:155)

   at org.hi...@6.1.5.Final//org.hibernate.mapping.BasicValue.setExplicitCustomType(BasicValue.java:828)

   at org.hi...@6.1.5.Final//org.hibernate.cfg.annotations.BasicValueBinder.fillSimpleValue(BasicValueBinder.java:1238)

   at org.hi...@6.1.5.Final//org.hibernate.cfg.SetBasicValueTypeSecondPass.doSecondPass(SetBasicValueTypeSecondPass.java:26)

   at org.hi...@6.1.5.Final//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1782)

   at org.hi...@6.1.5.Final//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1729)

   at org.hi...@6.1.5.Final//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:300)

   at org.hi...@6.1.5.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)

   at org.hi...@6.1.5.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)

   at org.hibernate.ji...@27.0.1.Final//org.jboss.as.jpa.hibernate.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:45)

   at org.jbos...@27.0.1.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:171)

   ... 10 more

Caused by: java.lang.NullPointerException: Cannot invoke "jakarta.enterprise.inject.spi.BeanManager.createCreationalContext(jakarta.enterprise.context.spi.Contextual)" because "this.beanManager" is null

   at org.hi...@6.1.5.Final//org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy$NamedBeanImpl.initialize(JpaCompliantLifecycleStrategy.java:228)

Best regards,

Guillaume.


Guillaume G

unread,
Jan 6, 2023, 3:06:17 AM1/6/23
to WildFly
I forget one thing: i work with Eclipse IDE 2012-12 and it's impossible to update the CDI facet to the version 4, the same for JSF4...

Best regards,
Guillaume.

Johann Kneringer

unread,
Jan 16, 2023, 10:26:33 AM1/16/23
to WildFly
Hi Guillaume,

i am facing the same issue...did you made any effort?

best regards,
Johann

Message has been deleted

Johann Kneringer

unread,
Jan 17, 2023, 6:59:11 AM1/17/23
to WildFly
I came some steps further:

What I did is I did set a Breaktpoint at the Construtor from NullPointerException.class.

So I saw which bean is the conflicting one...In my case it was some JSON-B Mapping on a Column...removing this takes me one step further...hope this is helpful... 

best regards,
Johann

Scott Marlow

unread,
Jan 17, 2023, 1:45:59 PM1/17/23
to WildFly
Hi Guillaume, Johann,

Could you both please share the contents of your persistence.xml that you are using.  Mostly I am looking for the persistence unit properties so that I can try to reproduce with the latest WildFly `main` branch.

Thanks,
Scott

Scott Marlow

unread,
Jan 17, 2023, 2:28:09 PM1/17/23
to WildFly
On Wednesday, January 4, 2023 at 2:34:13 PM UTC-5 elbr...@gmail.com wrote:

Hello,

I migrate to wildfly 27.0.1 and Java 17 but when i build my projects i get the following error (that i didn't get with previous version of wildfly):

Errors occurred during the build.

Errors running builder 'CDI (Contexts and Dependency Injection) Builder' on project 'XXX'.

Cannot invoke "org.jboss.jandex.ModuleInfo.setPackages(java.util.List)" because the return value of "org.jboss.jandex.ClassInfo.module()" is null

Which version of Jandex is your project pom.xml referencing?

I think that WildFly 27.0.1 is using 3.0.3 so you might need to recompile against Jandex 3.0.3 and correct any compilation errors.

<!-- https://mvnrepository.com/artifact/io.smallrye/jandex -->
<dependency>
    <groupId>io.smallrye</groupId>
    <artifactId>jandex</artifactId>
    <version>3.0.3</version>
</dependency>
 
Scott

Johann Kneringer

unread,
Jan 18, 2023, 3:39:29 AM1/18/23
to WildFly
Here is my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence
                                 https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
             version="3.0">

    <persistence-unit name="myDataSource" transaction-type="JTA">
        <jta-data-source>java:/myDataSourceDS</jta-data-source>
        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
        <properties>
            <property name="wildfly.jpa.default-unit" value="true"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
            <property name="hibernate.format_sql" value="false"/>
            <property name="hibernate.query.jpaql_strict_compliance" value="true"/>
            <property name="hibernate.jpa.compliance.query" value="false"/>
            <property name="hibernate.current_session_context_class" value="jta"/>
            <property name="hibernate.cache.use_second_level_cache" value="true" />
            <property name="hibernate.cache.use_query_cache" value="true" />
            <property name="hibernate.use_sql_comments" value="true"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.default_batch_fetch_size" value="20"/>
            <property name="hibernate.generate_statistics" value="false" />
            <property name="org.hibernate.envers.default_schema" value="MYAUDITSCHEMA"/>
            <property name="org.hibernate.envers.store_data_at_delete" value="true"/>
            <property name="hibernate.envers.autoRegisterListeners" value="true"/>
        </properties>
    </persistence-unit>
</persistence>



My issue has nothing to do with yandex, but the exception was excatly the same.

Scott Marlow

unread,
Jan 18, 2023, 10:02:11 AM1/18/23
to WildFly
Does your application include a beans.xml?  I'm curious if this behavior could be worked around by adding a beans.xml with bean-discovery-mode=all since CDI 4.0 is disabled by default.  The beans.xml would contain:


I'm not yet sure if your hitting a bug in WildFly in that we are not communicating correctly with Hibernate ORM 6.1.5 or if the bug is in Hibernate ORM itself in that Hibernate ORM cannot always expect all deployments to have a CDI BeanManager.

Scott

Johann Kneringer

unread,
Jan 18, 2023, 10:33:07 AM1/18/23
to WildFly
Yes, it includes 2 beans.xml...one on META-INF, one in WEB-INF...one is bean-discovery-mode=all, one annotated.

WEB-INF:
<beans bean-discovery-mode="all"
version="4.0">
</beans>

META-INF:
<beans bean-discovery-mode="annotated"
version="4.0">
</beans>

Scott Marlow

unread,
Jan 18, 2023, 10:48:53 AM1/18/23
to WildFly
Thanks, could you please try using <beans bean-discovery-mode="all" in both beans.xml just to see if that works around the deployment failure?

Scott

Johann Kneringer

unread,
Jan 19, 2023, 4:05:58 AM1/19/23
to WildFly
Hi scott,

i already did this...the funny thing was, that i had to annotate @named on all beans, even with discovery mode all.

Scott Marlow

unread,
Jan 19, 2023, 10:06:44 AM1/19/23
to WildFly
Sorry to hear that the beans.xml change didn't help.

Could you try to reproduce the "org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not (yet) ready to use" failure with the latest WildFly nightly build from our ci test server. 


If the NotYetReadyException failure still recreates, I would like to see a tracking https://hibernate.atlassian.net/browse/HHH issue created for that.  Either one of you could create the (Hibernate ORM) HHH issue or I could.  We could then continue discussing on the HHH issue instead of here.

Scott

Scott Marlow

unread,
Jan 19, 2023, 5:27:13 PM1/19/23
to WildFly
On Thursday, January 19, 2023 at 10:06:44 AM UTC-5 Scott Marlow wrote:
Sorry to hear that the beans.xml change didn't help.

Could you try to reproduce the "org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not (yet) ready to use" failure with the latest WildFly nightly build from our ci test server. 


If the NotYetReadyException failure still recreates, I would like to see a tracking https://hibernate.atlassian.net/browse/HHH issue created for that.  Either one of you could create the (Hibernate ORM) HHH issue or I could.  We could then continue discussing on the HHH issue instead of here.

FYI, I created https://hibernate.atlassian.net/browse/HHH-16069 for this issue and linked back to this thread.
 
Scott
Reply all
Reply to author
Forward
0 new messages