Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find CDI BeanManager

I'm trying to set up a simple application to use SpringBoot 2.1.1 and Java 11 over Wildfly 14 (because Wildfly 15 isn't supported by Eclipse).

The deploy failed because Wildfly cannot find the CDI BeanManager in the project. I'm only trying to follow the simple (official) tutorial, so I don't understand why the error appears.

This is the code:

pom.xml

<properties>
    <start-class>main</start-class>
</properties>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.1.RELEASE</version>
</parent>

<!-- Add typical dependencies for a web application -->
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<!-- Package as an executable jar -->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Application.java

package main;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

This is the stacktrace:

12:51:13,365 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "SpringBoot-0.0.1.war" (runtime-name: "SpringBoot-0.0.1.war") WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by io.undertow.util.FlexBase64$1 (jar:file:/C:/Users/87003556/Documents/Java/Wildfly%2014/modules/system/layers/base/io/undertow/core/main/undertow-core-2.0.13.Final.jar!/) to constructor java.lang.String(char[],boolean) WARNING: Please consider reporting this to the maintainers of io.undertow.util.FlexBase64$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 12:51:13,429 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443 12:51:13,531 INFO [org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 5.2.3.Final (Apache CXF 3.2.5.jbossorg-1) 12:51:15,606 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.http.server.reactive.ServletServerHttpResponse$ResponseAsyncListener due to an exception (enable DEBUG log level to see the cause) 12:51:15,606 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.http.server.reactive.ServletHttpHandlerAdapter$HandlerResultAsyncListener due to an exception (enable DEBUG log level to see the cause) 12:51:15,622 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to an exception (enable DEBUG log level to see the cause) 12:51:15,622 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the cause) 12:51:15,622 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.http.server.reactive.ServletServerHttpRequest$RequestAsyncListener due to an exception (enable DEBUG log level to see the cause) 12:51:15,794 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-7) ISPN000128: Infinispan version: Infinispan 'Estrella Galicia' 9.3.1.Final 12:51:15,966 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 72) WFLYCLINF0002: Started client-mappings cache from ejb container 12:51:16,075 INFO [io.undertow.servlet] (ServerService Thread Pool -- 85) 1 Spring WebApplicationInitializers detected on classpath 12:51:16,153 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 85) Initializing Mojarra 2.3.5.SP2 for context '/SpringBoot-0.0.1' 12:51:16,761 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 85) Critical error during deployment: : com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357) at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:243) at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443) at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237) at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ... at org.jboss.threads.JBossThread.run(JBossThread.java:485) Caused by: javax.faces.FacesException: Unable to find CDI BeanManager at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714) at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549) ... at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292) at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354) ... 29 more

12:51:16,761 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 85) MSC000001: Failed to start service jboss.deployment.unit."SpringBoot-0.0.1.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."SpringBoot-0.0.1.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ... at java.base/java.lang.Thread.run(Thread.java:825) at org.jboss.threads.JBossThread.run(JBossThread.java:485) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) ... 8 more Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:315) at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) ... at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250) ... 10 more Caused by: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:357) ... at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237) ... 26 more Caused by: javax.faces.FacesException: Unable to find CDI BeanManager at com.sun.faces.application.ApplicationImpl.isJsf23(ApplicationImpl.java:2714) at com.sun.faces.application.ApplicationImpl.addELResolver(ApplicationImpl.java:549) at org.jboss.as.jsf.injection.weld.WeldApplication.(WeldApplication.java:60) at org.jboss.as.jsf.injection.weld.WeldApplicationFactory.getApplication(WeldApplicationFactory.java:52) at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:88) ... at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:292) at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:354) ... 29 more

12:51:16,762 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "SpringBoot-0.0.1.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"SpringBoot-0.0.1.war\".undertow-deployment" => "java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. Caused by: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. Caused by: javax.faces.FacesException: Unable to find CDI BeanManager"}} 12:51:16,762 INFO [org.jboss.as.server] (ServerService Thread Pool -- 42) WFLYSRV0010: Deployed "SpringBoot-0.0.1.war" (runtime-name : "SpringBoot-0.0.1.war") 12:51:16,762 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."SpringBoot-0.0.1.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly.

like image 426
DeooK Avatar asked Jan 03 '19 12:01

DeooK


People also ask

Is it necessary to include the context that start CDI configuration?

Remember, is necessary to include the context that start the CDI configuration. Show activity on this post. Not directly related to your Problem, but maybe it might help someone else. We are using SpringBoot with joinfaces, in our case the problem was caused by an error in the faces-config.xml - specifically in the header part <faces-config ...>.

Do I need CDI with spring-faces?

With spring-faces i do not need CDI. Sorry, something went wrong. If needed, you may opt to look at a bridge from CDI to whatever technology you want to bridge it. CDI has support for that via portable extensions.

Is there a way to bridge CDI to any other technology?

If needed, you may opt to look at a bridge from CDI to whatever technology you want to bridge it. CDI has support for that via portable extensions. Sorry, something went wrong.


2 Answers

As we discussed in the comments, the solution might be as simple as adding the cdi-api to your pom.xml dependencies. It's not included within the dependencies you specified.

<dependency> 
    <groupId>javax.enterprise</groupId> 
    <artifactId>cdi-api</artifactId> 
    <version>1.2</version> 
</dependency>
like image 73
Assafs Avatar answered Sep 18 '22 13:09

Assafs


Remember, is necessary to include the context that start the CDI configuration.

<Resource name="BeanManager" auth="Container" type="javax.enterprise.inject.spi.BeanManager" factory="org.apache.webbeans.container.ManagerObjectFactory" />

You can check the all setup here

Or you can review this blog

like image 40
ogarzonm Avatar answered Sep 22 '22 13:09

ogarzonm