当前位置: 首页 > 知识库问答 >
问题:

NPE ConfigureListener Tomcat 8+JSF 2.3[重复]

毋炳
2023-03-14

我正试图将应用程序设置为使用Tomcat8和JSF2.3运行,但出现了以下错误:

RAVE: Critical error during deployment: 
java.lang.NullPointerException
    at java.util.Objects.requireNonNull(Objects.java:203)
    at javax.el.CompositeELResolver.add(CompositeELResolver.java:47)
    at com.sun.faces.el.DemuxCompositeELResolver.addRootELResolver(DemuxCompositeELResolver.java:142)
    at com.sun.faces.el.ELUtils.addEL3_0_Resolvers(ELUtils.java:336)
    at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:258)
    at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:499)
    at com.sun.faces.application.ApplicationImpl.performOneTimeELInitialization(ApplicationImpl.java:1404)
    at com.sun.faces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:526)
    at javax.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:621)
    at javax.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:621)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:256)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    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:748)

sep 05, 2017 12:14:51 PM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: java.lang.NullPointerException
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:315)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    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:748)
Caused by: java.lang.NullPointerException
    at java.util.Objects.requireNonNull(Objects.java:203)
    at javax.el.CompositeELResolver.add(CompositeELResolver.java:47)
    at com.sun.faces.el.DemuxCompositeELResolver.addRootELResolver(DemuxCompositeELResolver.java:142)
    at com.sun.faces.el.ELUtils.addEL3_0_Resolvers(ELUtils.java:336)
    at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:258)
    at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:499)
    at com.sun.faces.application.ApplicationImpl.performOneTimeELInitialization(ApplicationImpl.java:1404)
    at com.sun.faces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:526)
    at javax.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:621)
    at javax.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:621)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:256)
    ... 9 more
<properties>

    <!-- Librerias JSF -->
    <omnifaces.version>2.6.4</omnifaces.version>
    <prettyfaces.version>3.3.3</prettyfaces.version>
    <primefaces.version>6.1</primefaces.version>
    <primefaces.themes.version>1.0.10</primefaces.themes.version>
    <primefaces-extensions.version>6.1.1</primefaces-extensions.version>
    <javax.faces.version>2.3.2</javax.faces.version>
    <javax.el.api.version>3.0.0</javax.el.api.version>

    <!-- Spring -->
    <spring.version>4.3.10.RELEASE</spring.version>

    <!-- Servlet -->
    <jstl.version>1.2</jstl.version>
    <javax.servlet.api.version>4.0.0</javax.servlet.api.version>        

    <!-- CDI -->
    <weld.servlet.shaded.version>3.0.0.Final</weld.servlet.shaded.version>
    <cdi.api.version>2.0</cdi.api.version>

    <!-- Hibernate -->
    <hibernate.show_sql>true</hibernate.show_sql>
    <hibernate.generate_ddl>true</hibernate.generate_ddl>
</properties>

<dependencies>

    <!-- JSF dependencies -->
    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>${javax.faces.version}</version>
    </dependency>

    <!-- JSF 2 y expresiones EL RI -->
    <dependency>
        <groupId>javax.el</groupId>
        <artifactId>javax.el-api</artifactId>
        <version>${javax.el.api.version}</version>
    </dependency>

    <!-- Spring dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- Prettyfaces dependencies -->
    <dependency>
        <groupId>com.ocpsoft</groupId>
        <artifactId>prettyfaces-jsf2</artifactId>
        <version>${prettyfaces.version}</version>
    </dependency>

    <!-- Omnifaces dependencies -->
    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>${omnifaces.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>

    <!-- JSF Primefaces -->
    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>flick</artifactId>
        <version>${primefaces.themes.version}</version>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>${primefaces.version}</version>
    </dependency>
    <dependency>
        <groupId>org.primefaces.extensions</groupId>
        <artifactId>primefaces-extensions</artifactId>
        <version>${primefaces-extensions.version}</version>
    </dependency>

    <!-- Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${javax.servlet.api.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>${jstl.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.weld.servlet</groupId>
        <artifactId>weld-servlet-shaded</artifactId>
        <version>${weld.servlet.shaded.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>${cdi.api.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<?xml version="1.0" encoding="UTF-8"?>
<Context allowCasualMultipartParsing="true">
    <Resource name="BeanManager" 
        auth="Container"
        type="javax.enterprise.inject.spi.BeanManager"
        factory="org.jboss.weld.resources.ManagerObjectFactory" />
</Context>

我是否遗漏了一些库?,也许版本是错误的?

谢了。

共有1个答案

陈宜修
2023-03-14

除了Maven依赖项之外,您的项目中还有其他JAR吗?在我的项目中有el-impl-2.2.jar(旧时代的残余),显然这引起了冲突。我从web.xml中删除了jar和以下部分:

<context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

现在应用程序启动时没有错误。

 类似资料:
  • 我试图在tomcat 8上设置jsf 2.3,每当我使用“注入”时,我总是有一个错误,我已经在谷歌上搜索了stackoverflow.com但我找不到解决方案。我已经在上面安装了CDI(焊接),下面是@BalusC示例。如何在Tomcat上安装和使用CDI?然而,我一直有不满意的依赖:没有bean匹配注入点。我想不出来我是不是错过了什么? 配置bean。JAVA 豆。xml faces-confi

  • 我正在尝试Open Liberty并想尝试JSF-2.3支持。我一定在做什么傻事,因为当尝试隐式导航时,我立即得到异常:

  • 在用户登录时续订HTTP会话是常见的最佳做法。这将强制使用新的会话ID,从而避免会话固定漏洞。 当涉及@SessionScoped bean时,是否有使用CDI实现此功能的首选模式?困难在于,通过使当前HTTP会话无效,您将在下一个请求中获得不同的会话范围bean,但直到下一个请求。 例如,假设一个用于存储用户登录信息的会话bean: 和另一个用于管理登录的bean: 对于托管Bean,这将检索一

  • 我正在使用,并且已经将依赖项从: 致: 但现在我得到一个构建错误: 在或我的应用程序中的其他地方还有更多的更改要做吗?

  • 我想将和bean注入到我的实现中,但是我得到了。 我使用tomcat和weld实现来实现CDI。我开始将JSF2.2迁移到2.3,因此从改为CDI。我将替换为以及迁移过程中必须做的其他事情,如:-向每个模块添加beansxml-向上下文添加BeanManager-从faces删除bean声明-config.XML-将SPI作为resource-env-ref添加到web.XML如何向实现注入bea

  • 嗨,我想知道是否有人能帮我。我有两个。xsd架构文件顺序服务顺序。xsd和order。xsd,每个xsd都将元素类型命名为“order”。 当我开始为这些模式文件创建Java源代码时,我显然在Order类上遇到了类名冲突。 我创建了一个jaxb bindings. xjb文件来重命名从orderservice-order.xsd.生成的订单类名 然而,我仍然得到以下错误 中的XPATH似乎没有问题

  • 上面说这是一次意外的超驰,但这不是偶然的... 我想要的可能吗?还是必须重写方法。我更喜欢kotlin setter..

  • 当我运行这段代码时,它会打印。我的问题是为什么没有编译时错误?对象和字符串的默认值为NULL。那么为什么不编译器说。