JSF 2.3 启动中未定义的组件类型 javax.faces.ViewRoot
Undefined component type javax.faces.ViewRoot in JSF 2.3 startup
这是我之前发现的问题的新转折 。
我正在从 MyFaces 2.1 升级到 2.3.5,从 PrimeFaces 6.1 升级到 7。这还包括从托管 beans 迁移到 CDI。此时,服务器启动,似乎正在初始化 MyFaces、PrimeFaces 和 CDI。但是,当我尝试加载第一页时,我得到“Undefined component type javax.faces.ViewRoot
”。请注意,这是 "component type" 而不是 class。
追踪到 MyFaces 代码,我可以看到组件 class 地图正在用许多组件初始化,但没有与 ViewRoot 相似的组件。我对尝试手动注册 UIViewRoot 犹豫不决,因为这对于早期版本来说不是必需的,而且我还没有看到任何提及这样的事情是必要的。
任何人都可以指出我可能做错了什么吗?
我在下面包含了相关的配置和日志文件(已删节)。
[@tandraschko 对我最近在这里的挣扎提供了很大帮助,我正在使用非捆绑的 MyFaces api & impl 库。正如您所建议的,我将创建一个精简的项目,看看我是否可以在较小的规模上重现或识别该问题。]
pom.xml
<!-- MyFaces -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3.5</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
<!-- Tomcat -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>9.0.30</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version>9.0.12</version>
<scope>provided</scope>
</dependency>
<!-- OpenWebBeans - implements CDI Container -->
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
<version>${owb.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
<version>${owb.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-jsf</artifactId>
<version>${owb.version}</version>
</dependency>
<!-- Apache taglibs -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>
<!-- Misc -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
面孔-config.xml
<lifecycle>
<phase-listener>
com.company.application.security.AuthorizationListener
</phase-listener>
</lifecycle>
<lifecycle>
<phase-listener>org.primefaces.component.lifecycle.LifecyclePhaseListener</phase-listener>
</lifecycle>
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.DataTableRenderer</renderer-type>
<renderer-class>com.company.common.web.CustomDataTableRenderer</renderer-class>
</renderer>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.MenubarRenderer</renderer-type>
<renderer-class>com.company.common.web.CustomMenubarRenderer</renderer-class>
</renderer>
</render-kit>
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
<action-listener>
com.company.common.app.DialogActionListenerCompatibilityFix
<!-- This was necessary as default failed with missing default constructor -->
</action-listener>
<navigation-handler>
org.primefaces.application.DialogNavigationHandler
</navigation-handler>
<view-handler>
org.primefaces.application.DialogViewHandler
</view-handler>
</application>
web.xml
<listener>
<listener-class>com.company.application.app.AppApplicationContextListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.apache.myfaces.SUPPORT_MANAGED_BEANS</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.annotation.USE_CDI_FOR_ANNOTATION_SCANNING</param-name>
<param-value>true</param-value>
</context-param>
控制台输出
INFO: Server version: Apache Tomcat/9.0.8
INFO: Server built: Apr 27 2018 19:32:00 UTC
INFO: Server number: 9.0.8.0
INFO: OS Name: Windows 10
INFO: OS Version: 10.0
INFO: Architecture: amd64
INFO: Java Home: C:\Program Files\Java\OpenJDK_11.0.5.10
INFO: JVM Version: 11.0.5+10
INFO: JVM Vendor: AdoptOpenJDK
INFO: CATALINA_BASE: C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9
INFO: CATALINA_HOME: C:\Program Files\apache-tomcat-9.0.8
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:51836
INFO: Command line argument: -javaagent:C:\Eclipse\eclipse\configuration\org.eclipse.osgi9[=14=]\.cp\lib\javaagent-shaded.jar
INFO: Command line argument: -Dcatalina.base=C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9
INFO: Command line argument: -Dcatalina.home=C:\Program Files\apache-tomcat-9.0.8
INFO: Command line argument: -Dwtp.deploy=C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9\wtpwebapps
INFO: Command line argument: -Dfile.encoding=Cp1252
Jan 02, 2020 3:42:38 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jan 02, 2020 3:42:38 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.8
INFO common.app.ApplicationServicesProvisioner - Registering ApplicationServices Class as com.company.application.app.ApplicationServicesImpl
INFO common.app.DatabaseServicesProvisioner - Registering DatabaseServices Class as com.company.application.app.DatabaseServicesImpl
INFO web.lifecycle.WebContainerLifecycle - OpenWebBeans Container is starting...
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/beans.xml
INFO web.scanner.WebScannerService - Adding information from WEB-INF/beans.xml
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/websocket-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/ecj-4.7.3a.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/jaspic-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/annotations-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/classes/
INFO common.web.SessionBeanBase - Prime Faces version: 7.0
INFO webbeans.config.BeansDeployer - All injection points were validated successfully.
INFO web.lifecycle.WebContainerLifecycle - OpenWebBeans Container has started, it took [4028] ms.
INFO [Catalina].[localhost].[/app] - Initializing Spring root WebApplicationContext
INFO web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Thu Jan 02 15:42:46 EST 2020]; root of context hierarchy
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/check-database.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-infrastructure.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/batch-jobs.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'helloWorldJob': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'app_BatchJobRunner': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [license.config]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [application.secrets]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [application.properties]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'postProcessTasklet': replacing [Generic bean: class [com.company.application.batch.PostProcessBatchTest]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'completionNotificationTasklet': replacing [Generic bean: class [com.company.common.batch.BatchJobCompletionNotifier]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'xmlItemWriter': replacing [Generic bean: class [org.springframework.batch.item.xml.StaxEventItemWriter]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'appBatchJobTasklet': replacing [Generic bean: class [com.company.common.batch.BatchJobRunner]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]]
INFO common.db.appCheckDatabase - Loaded JDBC driver: org.postgresql.Driver
INFO common.db.appCheckDatabase - Skipping database accessibility check
INFO common.batch.appDriverManagerDataSource - Loaded JDBC driver: org.postgresql.Driver
INFO repository.support.JobRepositoryFactoryBean - No database type set, using meta data indicating: POSTGRES
INFO scheduling.concurrent.ThreadPoolTaskExecutor - Initializing ExecutorService
INFO scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService 'scheduler'
INFO oxm.jaxb.Jaxb2Marshaller - Creating JAXBContext with classes to be bound [class com.company.application.batch.Report]
INFO web.context.ContextLoader - Root WebApplicationContext: initialization completed in 4668 ms
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading standard config META-INF/standard-faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config /WEB-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/openwebbeans-el22-2.0.12.jar!/META-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/openwebbeans-jsf-2.0.12.jar!/META-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/primefaces-7.0.jar!/META-INF/faces-config.xml
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-api' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-api-2.3.5.jar'
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-impl' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-impl-2.3.5.jar'
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-impl-shared-public' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-impl-shared-public-2.3.5.jar'
INFO myfaces.util.ExternalSpecifications - MyFaces CDI support enabled
INFO spi.impl.DefaultInjectionProviderFactory - Using InjectionProvider org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider
INFO myfaces.util.ExternalSpecifications - MyFaces Bean Validation support disabled
INFO myfaces.config.FacesConfigurator - Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
INFO config.annotation.DefaultLifecycleProviderFactory - Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
INFO primefaces.webapp.PostConstructApplicationEventListener - Running on PrimeFaces 7.0
INFO myfaces.webapp.AbstractFacesInitializer - ServletContext initialized.
INFO myfaces.webapp.WebConfigParamsLogger - Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
WARN myfaces.webapp.AbstractFacesInitializer -
*******************************************************************
*** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. ***
*** ^^^^^^^^^^^ ***
*** Do NOT deploy to your live server(s) without changing this. ***
*** See Application#getProjectStage() for more information. ***
*******************************************************************
INFO myfaces.webapp.StartupServletContextListener - MyFaces Core has started, it took [2047] ms.
INFO catalina.startup.Catalina - Server startup in 14480 ms
[[[ browse to login.jsf ]]]
ERROR myfaces.application.ApplicationImpl - Undefined component type javax.faces.ViewRoot
INFO common.security.AuthorizationListenerBase - redirecting to the login page: session is not null, currentPage = , currentUser = null
INFO common.app.ApplicationContainerBase - Application startup
application Build: 0.1.0 (1); Updated: Monday November 4, 2019 4:29 pm
app Build: 2.1.8 (149); Updated: Friday, November 8, 2019 3:54 pm
INFO application.web.SessionBean - ========== Session Constructor ===============
INFO application.web.SessionBean - ===== Build #0.1.0 (1) Updated: Monday November 4, 2019 4:29 pm POSTGRESQL
INFO application.web.SessionBean - ==============================================
ERROR common.exceptions.appExceptionHandler - Apache root cause:
javax.faces.FacesException: Undefined component type javax.faces.ViewRoot
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1504)
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1472)
at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:133)
at org.apache.myfaces.shared.view.ViewDeclarationLanguageBase.createView(ViewDeclarationLanguageBase.java:53)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createView(FaceletViewDeclarationLanguage.java:2056)
at org.apache.myfaces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:264)
at javax.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:115)
at javax.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:115)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:2757)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:252)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.security.SsoAuthFilter.doFilter(SsoAuthFilter.java:136)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.RequestHeaderFilter.doFilter(RequestHeaderFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.URLSessionFilter.doFilter(URLSessionFilter.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.RawResourceFilter.doFilter(RawResourceFilter.java:150)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
终于!解决了。虽然,这个答案暴露了我的无知:
Don't rename your faces-config.xml
file to
standard-faces-config.xml
早些时候,我在设置 Maven 和 Eclipse 以正确构建包含我的所有库(包括 JSF)并被我的主应用程序项目引用的公共项目时遇到了问题。在某一时刻,主应用程序的 faces-config.xml
似乎覆盖了普通应用程序的 faces-config.xml
。我偶然发现了对 standard-faces-config.xml
的引用。所以我将公共 faces-config.xml
重命名为 standard-faces-config.xml
,这似乎有效。我以为这就是处理多项目应用程序的方法。
更糟糕的是,一旦我让 Maven 和 Eclipse 工作,我就怀疑这个变化。但是恢复文件名似乎没有做任何事情。这已成为我的第二个来之不易的教训:
With Maven and Eclipse, make sure you're really rebuilding and redeploying your projects
现在我做了很多次更改并重新启动,才意识到我的更改不包括在内。
非常感谢所有回复的人,尤其是@tandraschko!
这是我之前发现的问题的新转折
我正在从 MyFaces 2.1 升级到 2.3.5,从 PrimeFaces 6.1 升级到 7。这还包括从托管 beans 迁移到 CDI。此时,服务器启动,似乎正在初始化 MyFaces、PrimeFaces 和 CDI。但是,当我尝试加载第一页时,我得到“Undefined component type javax.faces.ViewRoot
”。请注意,这是 "component type" 而不是 class。
追踪到 MyFaces 代码,我可以看到组件 class 地图正在用许多组件初始化,但没有与 ViewRoot 相似的组件。我对尝试手动注册 UIViewRoot 犹豫不决,因为这对于早期版本来说不是必需的,而且我还没有看到任何提及这样的事情是必要的。
任何人都可以指出我可能做错了什么吗?
我在下面包含了相关的配置和日志文件(已删节)。
[@tandraschko 对我最近在这里的挣扎提供了很大帮助,我正在使用非捆绑的 MyFaces api & impl 库。正如您所建议的,我将创建一个精简的项目,看看我是否可以在较小的规模上重现或识别该问题。]
pom.xml
<!-- MyFaces -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3.5</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
<!-- Tomcat -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>9.0.30</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version>9.0.12</version>
<scope>provided</scope>
</dependency>
<!-- OpenWebBeans - implements CDI Container -->
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
<version>${owb.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
<version>${owb.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-jsf</artifactId>
<version>${owb.version}</version>
</dependency>
<!-- Apache taglibs -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>
<!-- Misc -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
面孔-config.xml
<lifecycle>
<phase-listener>
com.company.application.security.AuthorizationListener
</phase-listener>
</lifecycle>
<lifecycle>
<phase-listener>org.primefaces.component.lifecycle.LifecyclePhaseListener</phase-listener>
</lifecycle>
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.DataTableRenderer</renderer-type>
<renderer-class>com.company.common.web.CustomDataTableRenderer</renderer-class>
</renderer>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.MenubarRenderer</renderer-type>
<renderer-class>com.company.common.web.CustomMenubarRenderer</renderer-class>
</renderer>
</render-kit>
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
<action-listener>
com.company.common.app.DialogActionListenerCompatibilityFix
<!-- This was necessary as default failed with missing default constructor -->
</action-listener>
<navigation-handler>
org.primefaces.application.DialogNavigationHandler
</navigation-handler>
<view-handler>
org.primefaces.application.DialogViewHandler
</view-handler>
</application>
web.xml
<listener>
<listener-class>com.company.application.app.AppApplicationContextListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.apache.myfaces.SUPPORT_MANAGED_BEANS</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.annotation.USE_CDI_FOR_ANNOTATION_SCANNING</param-name>
<param-value>true</param-value>
</context-param>
控制台输出
INFO: Server version: Apache Tomcat/9.0.8
INFO: Server built: Apr 27 2018 19:32:00 UTC
INFO: Server number: 9.0.8.0
INFO: OS Name: Windows 10
INFO: OS Version: 10.0
INFO: Architecture: amd64
INFO: Java Home: C:\Program Files\Java\OpenJDK_11.0.5.10
INFO: JVM Version: 11.0.5+10
INFO: JVM Vendor: AdoptOpenJDK
INFO: CATALINA_BASE: C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9
INFO: CATALINA_HOME: C:\Program Files\apache-tomcat-9.0.8
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:51836
INFO: Command line argument: -javaagent:C:\Eclipse\eclipse\configuration\org.eclipse.osgi9[=14=]\.cp\lib\javaagent-shaded.jar
INFO: Command line argument: -Dcatalina.base=C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9
INFO: Command line argument: -Dcatalina.home=C:\Program Files\apache-tomcat-9.0.8
INFO: Command line argument: -Dwtp.deploy=C:\Users\name\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp9\wtpwebapps
INFO: Command line argument: -Dfile.encoding=Cp1252
Jan 02, 2020 3:42:38 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jan 02, 2020 3:42:38 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.8
INFO common.app.ApplicationServicesProvisioner - Registering ApplicationServices Class as com.company.application.app.ApplicationServicesImpl
INFO common.app.DatabaseServicesProvisioner - Registering DatabaseServices Class as com.company.application.app.DatabaseServicesImpl
INFO web.lifecycle.WebContainerLifecycle - OpenWebBeans Container is starting...
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/beans.xml
INFO web.scanner.WebScannerService - Adding information from WEB-INF/beans.xml
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/websocket-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/ecj-4.7.3a.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/jaspic-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/annotations-api.jar
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Program%20Files/apache-tomcat-9.0.8/lib/
INFO corespi.scanner.AbstractMetaDataDiscovery - added beans archive URL: file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/classes/
INFO common.web.SessionBeanBase - Prime Faces version: 7.0
INFO webbeans.config.BeansDeployer - All injection points were validated successfully.
INFO web.lifecycle.WebContainerLifecycle - OpenWebBeans Container has started, it took [4028] ms.
INFO [Catalina].[localhost].[/app] - Initializing Spring root WebApplicationContext
INFO web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Thu Jan 02 15:42:46 EST 2020]; root of context hierarchy
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/check-database.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-infrastructure.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/batch-jobs.xml]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'helloWorldJob': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'app_BatchJobRunner': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [license.config]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [application.secrets]
INFO factory.config.PropertyPlaceholderConfigurer - Loading properties file from class path resource [application.properties]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'postProcessTasklet': replacing [Generic bean: class [com.company.application.batch.PostProcessBatchTest]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'completionNotificationTasklet': replacing [Generic bean: class [com.company.common.batch.BatchJobCompletionNotifier]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'xmlItemWriter': replacing [Generic bean: class [org.springframework.batch.item.xml.StaxEventItemWriter]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/helloWorldJob.xml]]
INFO factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'appBatchJobTasklet': replacing [Generic bean: class [com.company.common.batch.BatchJobRunner]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in ServletContext resource [/WEB-INF/batch-jobs/appBatchRunnerJob.xml]]
INFO common.db.appCheckDatabase - Loaded JDBC driver: org.postgresql.Driver
INFO common.db.appCheckDatabase - Skipping database accessibility check
INFO common.batch.appDriverManagerDataSource - Loaded JDBC driver: org.postgresql.Driver
INFO repository.support.JobRepositoryFactoryBean - No database type set, using meta data indicating: POSTGRES
INFO scheduling.concurrent.ThreadPoolTaskExecutor - Initializing ExecutorService
INFO scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService 'scheduler'
INFO oxm.jaxb.Jaxb2Marshaller - Creating JAXBContext with classes to be bound [class com.company.application.batch.Report]
INFO web.context.ContextLoader - Root WebApplicationContext: initialization completed in 4668 ms
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading standard config META-INF/standard-faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config /WEB-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/openwebbeans-el22-2.0.12.jar!/META-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/openwebbeans-jsf-2.0.12.jar!/META-INF/faces-config.xml
INFO myfaces.config.DefaultFacesConfigurationProvider - Reading config : jar:file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/primefaces-7.0.jar!/META-INF/faces-config.xml
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-api' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-api-2.3.5.jar'
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-impl' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-impl-2.3.5.jar'
INFO myfaces.config.LogMetaInfUtils - Artifact 'myfaces-impl-shared-public' was found in version '2.3.5' from path 'file:/C:/Users/name/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp9/wtpwebapps/app/WEB-INF/lib/myfaces-impl-shared-public-2.3.5.jar'
INFO myfaces.util.ExternalSpecifications - MyFaces CDI support enabled
INFO spi.impl.DefaultInjectionProviderFactory - Using InjectionProvider org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider
INFO myfaces.util.ExternalSpecifications - MyFaces Bean Validation support disabled
INFO myfaces.config.FacesConfigurator - Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
INFO config.annotation.DefaultLifecycleProviderFactory - Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
INFO primefaces.webapp.PostConstructApplicationEventListener - Running on PrimeFaces 7.0
INFO myfaces.webapp.AbstractFacesInitializer - ServletContext initialized.
INFO myfaces.webapp.WebConfigParamsLogger - Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
WARN myfaces.webapp.AbstractFacesInitializer -
*******************************************************************
*** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. ***
*** ^^^^^^^^^^^ ***
*** Do NOT deploy to your live server(s) without changing this. ***
*** See Application#getProjectStage() for more information. ***
*******************************************************************
INFO myfaces.webapp.StartupServletContextListener - MyFaces Core has started, it took [2047] ms.
INFO catalina.startup.Catalina - Server startup in 14480 ms
[[[ browse to login.jsf ]]]
ERROR myfaces.application.ApplicationImpl - Undefined component type javax.faces.ViewRoot
INFO common.security.AuthorizationListenerBase - redirecting to the login page: session is not null, currentPage = , currentUser = null
INFO common.app.ApplicationContainerBase - Application startup
application Build: 0.1.0 (1); Updated: Monday November 4, 2019 4:29 pm
app Build: 2.1.8 (149); Updated: Friday, November 8, 2019 3:54 pm
INFO application.web.SessionBean - ========== Session Constructor ===============
INFO application.web.SessionBean - ===== Build #0.1.0 (1) Updated: Monday November 4, 2019 4:29 pm POSTGRESQL
INFO application.web.SessionBean - ==============================================
ERROR common.exceptions.appExceptionHandler - Apache root cause:
javax.faces.FacesException: Undefined component type javax.faces.ViewRoot
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1504)
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1472)
at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:133)
at org.apache.myfaces.shared.view.ViewDeclarationLanguageBase.createView(ViewDeclarationLanguageBase.java:53)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createView(FaceletViewDeclarationLanguage.java:2056)
at org.apache.myfaces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:264)
at javax.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:115)
at javax.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:115)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:2757)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:252)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.security.SsoAuthFilter.doFilter(SsoAuthFilter.java:136)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.RequestHeaderFilter.doFilter(RequestHeaderFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.URLSessionFilter.doFilter(URLSessionFilter.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.company.common.web.RawResourceFilter.doFilter(RawResourceFilter.java:150)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
终于!解决了。虽然,这个答案暴露了我的无知:
Don't rename your
faces-config.xml
file tostandard-faces-config.xml
早些时候,我在设置 Maven 和 Eclipse 以正确构建包含我的所有库(包括 JSF)并被我的主应用程序项目引用的公共项目时遇到了问题。在某一时刻,主应用程序的 faces-config.xml
似乎覆盖了普通应用程序的 faces-config.xml
。我偶然发现了对 standard-faces-config.xml
的引用。所以我将公共 faces-config.xml
重命名为 standard-faces-config.xml
,这似乎有效。我以为这就是处理多项目应用程序的方法。
更糟糕的是,一旦我让 Maven 和 Eclipse 工作,我就怀疑这个变化。但是恢复文件名似乎没有做任何事情。这已成为我的第二个来之不易的教训:
With Maven and Eclipse, make sure you're really rebuilding and redeploying your projects
现在我做了很多次更改并重新启动,才意识到我的更改不包括在内。
非常感谢所有回复的人,尤其是@tandraschko!