I am trying to migrate a web application from MyFaces 1.1 to 2.2.
I basically followed the first steps under Basic Changes from https://stackoverflow.com/a/4532870/5467214 to upgrade from JSF 1.1 to JSF 2.2:
web.xml
faces-config.xml
myfaces
jars with version 2.2 jarsFor the time being, I intend to keep JSP and replace them with Facelets once the first, presumably "painless" steps of just upgrading JSF are successful.
The web application worked with the old JSF version but after doing the steps described above, I get the following error and stack trace:
java.lang.NoClassDefFoundError: com/sun/facelets/tag/jsf/ComponentHandler
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1191)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.myfaces.shared.util.ClassUtils.classForName(ClassUtils.java:187)
at org.apache.myfaces.view.facelets.util.ReflectionUtil.forName(ReflectionUtil.java:66)
at org.apache.myfaces.view.facelets.compiler.TagLibraryConfig.createClass(TagLibraryConfig.java:539)
at org.apache.myfaces.view.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:466)
at org.apache.myfaces.view.facelets.compiler.FaceletsCompilerSupport.loadLibraries(FaceletsCompilerSupport.java:157)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.loadLibraries(FaceletViewDeclarationLanguage.java:2526)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createCompiler(FaceletViewDeclarationLanguage.java:2172)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.initialize(FaceletViewDeclarationLanguage.java:2464)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.<init>(FaceletViewDeclarationLanguage.java:309)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguageStrategy.<init>(FaceletViewDeclarationLanguageStrategy.java:52)
at org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl.initialize(ViewDeclarationLanguageFactoryImpl.java:104)
at org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl.getViewDeclarationLanguage(ViewDeclarationLanguageFactoryImpl.java:73)
at org.apache.myfaces.application.ViewHandlerImpl.getViewDeclarationLanguage(ViewHandlerImpl.java:183)
at org.apache.myfaces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:255)
at org.jenia.faces.template.handler.ViewHandler.createView(ViewHandler.java:251)
at javax.faces.application.ViewHandlerWrapper.createView(ViewHandlerWrapper.java:100)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.createView(ResourceViewHandlerWrapper.java:70)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:289)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:489)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:467)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:412)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:201)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.sun.facelets.tag.jsf.ComponentHandler
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 54 more
java.lang.NullPointerException
at net.sf.jsfcomp.chartcreator.ChartListener.afterPhase(ChartListener.java:42)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:117)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:211)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:489)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:467)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:412)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:201)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
We use Tomcat7 as a servlet container, IntelliJ Community Edition as IDE and Maven as a build manager and for dependency management.
Since "Tomahawk" appears in the stack trace, I replaced tomahawk-1.1.9.jar
with tomahawk21-1.1.14.jar
in my /WEB-INF/lib
, according to Which jars do I need in order to avoid "NoClassDefFoundError: com/sun/facelets/tag/jsf/ComponentHandler"?. Unfortunately, it didn't solve the problem.
I also couldn't find a tomahawk version specifically for JSF 2.2, neither in the maven repository nor anywhere else.
Would that be necessary to use tomahawk with MyFaces 2.2?
Or does the error stem from something else?
From the stacktrace, I suspect another JSF 1.x specific library causes this:
at org.jenia.faces.template.handler.ViewHandler.createView(ViewHandler.java:251)
So check what the 'jenia' library is and get a newer jsf 2 compatible version or remove it.