Ste*_*hio 4 jsf spring maven jsf-2
我正在使用MAVEN
并且已经更改了我的pom.xml
依赖项:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.14</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.13</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
至:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.3.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但现在我得到一个构建错误:
javax.faces.FacesException:无法在com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:312)〜[javax.faces-2.3.0.jar:2.3.0]的com.sun中找到CDI BeanManager .faces.el.ELUtils.buildFacesResolver(ELUtils.java:242)〜[javax.faces-2.3.0.jar:2.3.0] at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:484) 〜[javax.faces-2.3.0.jar:2.3.0] at com.sun.faces.application.ApplicationImpl.performOneTimeELInitialization(ApplicationImpl.java:1404)~ [javax.faces-2.3.0.jar:2.3.0 ] com.sun.faces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:526)〜[javax.faces-2.3.0.jar:2.3.0] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener) .java:256)〜[javax.faces-2.3.0.jar:2.3.0] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4725)[tomcat-embed-core-8.5.5 .jar:8.5.5] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)[tomcat-embed-core-8.5.5.jar:8.5.5] org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)[tomcat-embed-core-8.5.5.jar:8.5.5] at org.apache.catalina.core.ContainerBase $ StartChild .call(ContainerBase.java:1403)[tomcat-embed-core-8.5.5.jar:8.5.5]在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1393)[tomcat- java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor)中java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_111]的embed-core-8.5.5.jar:8.5.5] .java:1142)[na:1.8.0_111] java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_111] at java.lang.Thread.run(Thread.java) :745)[na:1.8.0_111]
2017-05-15 11:12:44.071 ERROR 9936 --- [ost-startStop-1] oaccC [Tomcat].[localhost].[/]:将上下文初始化事件发送到类com.sun.faces的监听器实例的异常.config.ConfigureListener
java.lang.RuntimeException:javax.faces.FacesException:无法在com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:315)〜[javax.faces-2.3.0.jar:2.3中找到CDI BeanManager. 0]在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4725)[tomcat-embed-core-8.5.5.jar:8.5.5] org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5189)[tomcat-embed-core-8.5.5.jar:8.5.5] org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)[tomcat-embed-core- 8.5.5.jar:8.5.5] org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1403)[tomcat-embed-core-8.5.5.jar:8.5.5] at org .apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1393)[tomcat-embed-core-8.5.5.jar:8.5.5] at java.util.concurrent.FutureTask.run(FutureTask.java :266)在[java:.olExecutor $ Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_111] at java.lang.Thread.run(Thread.java:745)[na:1.8.0_111]引起:javax.faces.FacesException:无法在com.sun.faces.el.ELUtils的com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:312)〜[javax.faces-2.3.0.jar:2.3.0]找到CDI BeanManager .buildFacesResolver(ELUtils.java:242)〜[javax.faces-2.3.0.jar:2.3.0] at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:484)〜[javax.faces- 2.3.0.jar:2.3.0] com.sun.faces.application.ApplicationImpl.performOneTimeELInitialization(ApplicationImpl.java:1404)〜[javax.faces-2.3.0.jar:2.3.0] at com.sun. face.sapp.Application.ApplicationImpl.getELResolver(ApplicationImpl.java:526)~ [javax.faces-2.3.0.jar:2.3.0] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:256)~ [javax.faces-2.3.0.jar:2.3.0]
我还将我的版本更新faces-config.xml
为2.3:
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.3">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<el-resolver>org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver</el-resolver>
</application>
<factory>
<exception-handler-factory>org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory</exception-handler-factory>
</factory>
Run Code Online (Sandbox Code Playgroud)
pom.xml
我的应用程序中的其他地方或其他任何地方是否有更多更改?
小智 11
老问题,但对于仍然面临这个问题的人:为了避免"无法找到CDI BeanManager"错误,重要的是你的faces-config.xml
版本不是 2.3
,你的web.xml
版本不是 4.0
!
Mojarra实现ELUtils类包含以下很好的代码:
if (getFacesConfigXmlVersion(facesContext).equals("2.3") || getWebXmlVersion(facesContext).equals("4.0")) {
throw new FacesException("Unable to find CDI BeanManager");
}
Run Code Online (Sandbox Code Playgroud)
使用较低版本时,它会跳过此检查,并使用Spring DI而不是CDI.
归档时间: |
|
查看次数: |
7670 次 |
最近记录: |