I hope someone from the TOMEE community can see this. I'm not sure if I better submit an issue in the TOMEE Jira project. I tested the same scenario in PC on Linux and MAC with same results
In short, when running a JSF application I got an error after I deployed this webapp using eclipse and TOMEE-9.0.0-M7 plus. Everything looks good during the startup, but when reaching the application context in the browser I got the error (see the code block)
Here is the GitHub repository with the project I tested
NOTE: I'm not using the maven plugin to run the war, I set up TOMEE in eclipse.
Thanks.
Here the stack trace:
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/samplejakarta9] threw exception [Undefined component type jakarta.faces.ViewRoot] with root cause
jakarta.faces.FacesException: Undefined component type jakarta.faces.ViewRoot
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1504)
at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1472)
at jakarta.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 jakarta.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:115)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:2758)
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 jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:204)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:67)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:353)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:870)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1696)
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)
The 9.0.0-M7 container is using a MyFaces version (2.3.8), which is not Jakarta Namespace ready yet.
See the related documentation here, which states:
3.0.x The upcoming Jakarta Faces 3.0. It's equals to JSF 2.3 but with "jakarta.faces" packages and constants instead of "javax.faces"
I just created TOMEE-3754 and will update the dependency, so it will be contained in the next release.
TomEE 9.0.0-M7 was build via bytecode transformation from the same codebase as the TomEE 8.0.x series, which is JavaEE namespace.
At the moment, both version bundle MyFaces in version 2.3.8, which cannot handle the Jakarta Namespace. It would be necessary to upgrade to MyFaces in version 3.0.x.
To fix up your example, you have to manually exchange the MyFaces version to 3.0.0. To do so, just delete
myfaces-api-2.3.8.jar
myfaces-impl-2.3.8.jar
in the lib
folder of the container. Then, you can replace them by version 3.0.0 via
You can also configure this behaviour via the TomEE Maven Plugin. Your POM would be something like:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>8.0.6</version> <!-- Note: No 9.0.0-M7 Maven Plugin is available yet but we can use the old one -->
<configuration>
<tomeeVersion>9.0.0-M7</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<debug>false</debug>
<tomeeHttpPort>8282</tomeeHttpPort>
<debugPort>5005</debugPort>
<args>-Dfoo=bar</args>
<config>${project.basedir}/src/test/tomee/conf</config>
<libs>
<lib>remove:myfaces</lib>
<!-- Adding MyFaces 3.0.0 JSF implementation -->
<lib>org.apache.myfaces.core:myfaces-impl:3.0.0</lib>
<lib>org.apache.myfaces.core:myfaces-api:3.0.0</lib>
</libs>
<skipCurrentProject>true</skipCurrentProject>
<webapps>
<webapp>
com.github.gdiazs:sample-jakarta9:1.0.0-SNAPSHOT
</webapp>
</webapps>
</configuration>
</plugin>
</plugins>
</build>