gpt4 book ai didi

java - 无法找到 CDI BeanManager

转载 作者:行者123 更新时间:2023-12-01 22:18:56 41 4
gpt4 key购买 nike

我正在尝试设置一个简单的应用程序,以在 Wildfly 14 上使用 SpringBoot 2.1.1 和 Java 11(因为 Eclipse 不支持 Wildfly 15)。

部署失败,因为 Wildfly 在项目中找不到 CDI BeanManager。我只是想遵循简单的(官方)教程,所以我不明白为什么会出现错误。

这是代码:

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>

应用程序.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);
}

}

这是堆栈跟踪:

> 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.<init>(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.

最佳答案

正如我们在评论中讨论的那样,解决方案可能就像将 cdi-api 添加到 pom.xml 依赖项一样简单。它不包含在您指定的依赖项中。

<dependency> 
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>

关于java - 无法找到 CDI BeanManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54021886/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com