我正在尝试将OmniFaces用于转换器。但是它不会初始化。我在Ubuntu上运行eclipse。我还没有在项目中实现任何转换器或任何其他OmniFaces代码。但目的是使用列表转换器以及可能使用PrimeFaces的其他转换器。
然而,这个问题似乎与omnifaces无关。看起来它可能取决于JSF的多个版本。但是我的项目中只有mojarra。可能是任何冲突的其他依赖项。直到我试图包括omnifaces,问题才出现。 Primefaces一直运行没有问题。
栈跟踪
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:453)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.faces.FacesException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:516)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:446)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:359)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:137)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:239)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
... 10 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:512)
... 17 more
Caused by: java.lang.NullPointerException
at com.sun.faces.config.ConfigManager$ProvideMetadataToAnnotationScanTask.initializeIvars(ConfigManager.java:877)
at com.sun.faces.config.ConfigManager$ProvideMetadataToAnnotationScanTask.getAnnotationScanURIs(ConfigManager.java:890)
at com.sun.faces.config.ConfigManager$ProvideMetadataToAnnotationScanTask.access$400(ConfigManager.java:834)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:962)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:916)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:387)
... 10 more
<!-- o:converter converterId="omnifaces.ListConverter" list="#{backingLeague.listLeague.source}" / -->
依赖
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.2.15.Final</version>
</dependency>
页面包含
<h:html lang="sv-SE"
xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions">
context.xml中
<Context>
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory" />
</Context>