我从tomcat7更改为tomcate8.5.41 在其上部署我的应用程序时失败 java code for login bean
此行抛出异常
private static Logger logger = (Logger) LoggerFactory.getLogger(LoginBean.class);
我使用primefaces 7 jsf 2.2.6
我认为原因之一是由于日志记录模块
我试图添加以下依赖项,但也无法正常工作
我试图添加日志依赖项,但也无法正常工作
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/mySharedData/Mokalmat/WorkSpaces/EclipseWorkSpace/VAS_prime_7_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConfigurationWebTool/WEB-INF/lib/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/mySharedData/Mokalmat/WorkSpaces/EclipseWorkSpace/VAS_prime_7_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConfigurationWebTool/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6, 1.7]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Jun 12, 2019 3:02:57 PM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: javax.faces.FacesException: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:508)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:340)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
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:435)
... 10 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:504)
... 17 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.sun.faces.util.Util.loadClass(Util.java:325)
at com.sun.faces.config.AnnotationScanner.processClassList(AnnotationScanner.java:309)
at com.sun.faces.config.JavaClassScanningAnnotationScanner.getAnnotatedClasses(JavaClassScanningAnnotationScanner.java:128)
at com.sun.faces.config.DelegatingAnnotationProvider.getAnnotatedClasses(DelegatingAnnotationProvider.java:85)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:932)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:884)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:383)
... 10 more
Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at com.vis.vasplatform.web.configuration.beans.LoginBean.<clinit>(LoginBean.java:42)
... 20 more
Jun 12, 2019 3:02:57 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class [com.sun.faces.config.ConfigureListener]
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
... 9 more
Caused by: javax.faces.FacesException: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:508)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:340)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
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:435)
... 10 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:504)
... 17 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.sun.faces.util.Util.loadClass(Util.java:325)
at com.sun.faces.config.AnnotationScanner.processClassList(AnnotationScanner.java:309)
at com.sun.faces.config.JavaClassScanningAnnotationScanner.getAnnotatedClasses(JavaClassScanningAnnotationScanner.java:128)
at com.sun.faces.config.DelegatingAnnotationProvider.getAnnotatedClasses(DelegatingAnnotationProvider.java:85)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:932)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:884)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:383)
... 10 more
Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at com.vis.vasplatform.web.configuration.beans.LoginBean.<clinit>(LoginBean.java:42)
... 20 more
.......
Jun 12, 2019 3:02:59 PM javax.faces.FactoryFinder$FactoryManager getFactory
SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.
Jun 12, 2019 3:02:59 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:310)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4817)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5474)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
I tried to add the following dependency and also not working
<dependency> -->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/mySharedData/Mokalmat/WorkSpaces/EclipseWorkSpace/VAS_prime_7_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConfigurationWebTool/WEB-INF/lib/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/mySharedData/Mokalmat/WorkSpaces/EclipseWorkSpace/VAS_prime_7_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConfigurationWebTool/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6, 1.7]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Jun 12, 2019 3:02:57 PM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: javax.faces.FacesException: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:508)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:340)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
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:435)
... 10 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:504)
... 17 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.sun.faces.util.Util.loadClass(Util.java:325)
at com.sun.faces.config.AnnotationScanner.processClassList(AnnotationScanner.java:309)
at com.sun.faces.config.JavaClassScanningAnnotationScanner.getAnnotatedClasses(JavaClassScanningAnnotationScanner.java:128)
at com.sun.faces.config.DelegatingAnnotationProvider.getAnnotatedClasses(DelegatingAnnotationProvider.java:85)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:932)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:884)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:383)
... 10 more
Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at com.vis.vasplatform.web.configuration.beans.LoginBean.<clinit>(LoginBean.java:42)
... 20 more
Jun 12, 2019 3:02:57 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class [com.sun.faces.config.ConfigureListener]
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
... 9 more
Caused by: javax.faces.FacesException: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:508)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:340)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
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:435)
... 10 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:504)
... 17 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.sun.faces.util.Util.loadClass(Util.java:325)
at com.sun.faces.config.AnnotationScanner.processClassList(AnnotationScanner.java:309)
at com.sun.faces.config.JavaClassScanningAnnotationScanner.getAnnotatedClasses(JavaClassScanningAnnotationScanner.java:128)
at com.sun.faces.config.DelegatingAnnotationProvider.getAnnotatedClasses(DelegatingAnnotationProvider.java:85)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:932)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:884)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:383)
... 10 more
Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at com.vis.vasplatform.web.configuration.beans.LoginBean.<clinit>(LoginBean.java:42)
... 20 more
.......
SEVERE: Unable to load annotated class: com.vis.vasplatform.web.configuration.beans.LoginBean, reason: java.lang.NoClassDefFoundError: Could not initialize class com.vis.vasplatform.web.configuration.beans.LoginBean
Jun 12, 2019 3:02:59 PM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
java.lang.StackOverflowError
at java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:261)
at java.lang.ThreadLocal.get(ThreadLocal.java:146)
at javax.faces.context.FacesContext.getCurrentInstance(FacesContext.java:897)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:798)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:793)
at javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder.java:768)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:377)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
Jun 12, 2019 3:02:59 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class [com.sun.faces.config.ConfigureListener]
java.lang.RuntimeException: java.lang.StackOverflowError
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Caused by: java.lang.StackOverflowError
at java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:261)
at java.lang.ThreadLocal.get(ThreadLocal.java:146)
at javax.faces.context.FacesContext.getCurrentInstance(FacesContext.java:897)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:798)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:793)
at javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder.java:768)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:377)
Jun 12, 2019 3:02:59 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Jun 12, 2019 3:02:59 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/ConfigurationWebTool] startup failed due to previous errors
Jun 12, 2019 3:02:59 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class [com.sun.faces.config.ConfigureListener]
java.lang.StackOverflowError
at org.apache.catalina.security.SecurityUtil.isPackageProtectionEnabled(SecurityUtil.java:425)
at org.apache.catalina.core.ApplicationContextFacade.getAttribute(ApplicationContextFacade.java:375)
at org.apache.catalina.core.StandardContext$NoPluggabilityServletContext.getAttribute(StandardContext.java:6599)
at com.sun.faces.context.ApplicationMap.get(ApplicationMap.java:97)
at javax.faces.FactoryFinder$FactoryManagerCacheKey.<init>(FactoryFinder.java:939)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:801)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:793)
at javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder.java:768)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:377)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
.......
Jun 12, 2019 3:02:59 PM javax.faces.FactoryFinder$FactoryManager getFactory
SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.
Jun 12, 2019 3:02:59 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:310)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4817)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5474)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
答案 0 :(得分:0)
我认为问题与slf4j的两个冲突实现有关。 (请参阅日志的第2行)
SLF4J: Class path contains multiple SLF4J bindings.
这两个实现在log中显示:
SLF4J: Found binding in [.../slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:.../logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
在您的项目中,您可以运行
mvn dependency:tree
命令并排除slf4j-simple-1.5.8.jar。
答案 1 :(得分:0)
问题是您的LoginBean
类的以下几行
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Logger;
...
private static Logger logger = (Logger) LoggerFactory.getLogger(LoginBean.class);
Logger
类是“ logback”类。
LoggerFactory
类是“ slf4j”类。
getLogger
方法返回某个实现org.slf4j.Logger
而不是ch.qos.logback.classic.Logger
的类的实例。您不能在此处使用类型转换,因为这两个类是不相关的。
您不能这样混合slf4j和logback。您需要在代码中使用slf4j API或logback API之间进行选择。
我不知道推荐哪个,因为共享的少量代码无法解释为什么您选择将logger
声明为登录Logger
。
但是无论哪种方式,引起ClassCastException
的问题都在您的代码中,而不是Tomcat或servlet配置中。可能还存在其他问题(例如,运行时有多个slf4j日志记录提供程序),但是这一个是显示停止器。