gpt4 book ai didi

java - 类转换异常 : Cannot cast FacesInitializer to ServletContainerInitializer with Tomcat 8

转载 作者:行者123 更新时间:2023-11-28 23:37:13 25 4
gpt4 key购买 nike

在我将 javaee-web-api-7.0.jar 添加到我的 JSF 项目后,它停止工作并出现错误:

org.apache.catalina.startup.ContextConfig.processServletContainerInitializers Failed to process JAR found at URL [/RegaloCE] for ServletContainerInitializers for context with name [{1}]

java.io.IOException: java.lang.ClassCastException: Cannot cast com.sun.faces.config.FacesInitializer to javax.servlet.ServletContainerInitializer

好吧,服务器 (apache tomcat 8) 中没有这个库,我也没有使用 maven。
从这里 (stackoverflow) 尝试了一些答案,但没有任何帮助..

谢谢

完整的堆栈跟踪

07-May-2014 14:53:51.111 SEVERE [http-apr-8080-exec-3] org.apache.catalina.startup.ContextConfig.processServletContainerInitializers Failed to process JAR found at URL [/RegaloCE] for ServletContainerInitializers for context with name [{1}]
java.io.IOException: java.lang.ClassCastException: Cannot cast com.sun.faces.config.FacesInitializer to javax.servlet.ServletContainerInitializer
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:185)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:151)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1597)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1125)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:579)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:455)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1554)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1448)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:901)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:335)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:615)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2451)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2440)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

最佳答案

因为我使用的是 NetBeans 8 而我不能将 TomEE 与 JEE Web 7 一起使用,所以我不得不将 javax.ejb 放在 {tomcat-home}/lib..

不幸的是,netbeans 仍然无法识别它,所以我更新了 nbproject 文件夹中的 project.properties 并添加了 ${j2ee.server.home}/lib/javax.ejb-api-3.2.jarj2ee.platform.classpath 属性..

现在 netbeans 识别库并用它构建,我不需要包含在项目库中..

(我在 java ee web api 中唯一需要的是注释和 ejb,现在我手动加载它们..

关于java - 类转换异常 : Cannot cast FacesInitializer to ServletContainerInitializer with Tomcat 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23525512/

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