How do I prevent Tomee from providing the jsf 2.2 jar and insure use of the jsf 2.3 jar?
Is this a maven configuration issue or a missing dependency issue or other?
Tomcat server log at startup includes the warning:
WARNING: You are using the library: myfaces-impl in different versions; first (and probably used) version is: 2.2.12 loaded from: file:/path/to/Apache/TomEE/apache-tomee-plus-7.0.5/lib/myfaces-api-2.2.12.jar, but also found the following versions: 2.3.2 loaded from: file:/path/to/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/ProjectName/WEB-INF/lib/myfaces-api-2.3.2.jar
Then further in the server log the proper constructor can't be found for TomcatAnnotationLifecycleProvider
SEVERE: org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider
java.lang.InstantiationException: org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider
at java.lang.Class.newInstance(Class.java:427)
at org.apache.myfaces.shared.util.ClassUtils.newInstance(ClassUtils.java:426)
at org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory.createClass(DefaultLifecycleProviderFactory.java:256)
at org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory.resolveLifecycleProviderFromService(DefaultLifecycleProviderFactory.java:203)
at org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory.getLifecycleProvider(DefaultLifecycleProviderFactory.java:86)
at org.apache.myfaces.config.FacesConfigurator.configureManagedBeanDestroyer(FacesConfigurator.java:1522)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:618)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:465)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:70)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:189)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:103)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4790)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodException: org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 19 more
pom.xml is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have added a faces-config.xml. This is the complete file content:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
version="2.3">
<!-- Config here. -->
</faces-config>
This just won't work as the TomEE integration just targets the MyFaces 2.2 packages and SPI. We did some refactoring on the MyFaces codebase during 2.3 development. I don't think you can get it running for 100%.
You can however just upgrade to TomEE 8.0.0.M1, which already has MyFaces 2.3 integrated.