3

I'm in process of migrating a JSF 1.2 application to JSF 2.x. My application is using the following APIs:

  • maven-jetty-plugin (version 6.1.10)
  • maven-compiler-plugin (version 2.3.1)
  • myfaces-api & -impl (version 1.2.7)
  • jsf-facelets (version 1.1.14)
  • richfaces (version 3.3.3)
  • javax servlet jstl (version 1.2)
  • javax servlet-api (version 2.5)
  • and some other plugins as well.

I updated the versions in faces-config.xml file and removed Facelets 1.1.14 libs and replaced MyFaces 1.2 by JSF 2.x libs, however the application didn't work. It threw the following exception:

    Could not instantiate listener org.apache.myfaces.webapp.StartupServletContextListener
java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:375)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    at org.mortbay.jetty.handler.ContextHandler.loadClass(ContextHandler.java:1035)
    at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:629)
    at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:367)
    at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initWebXmlElement(AbstractConfiguration.java:190)
    at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
    at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initialize(AbstractConfiguration.java:133)
    at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
    at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configure(AbstractConfiguration.java:113)
    at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
    at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configureWebApp(AbstractConfiguration.java:96)
    at org.mortbay.jetty.plus.webapp.Configuration.configureWebApp(Configuration.java:124)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:371)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:307)
    at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
    at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
2013-07-02 14:39:15.590::WARN:  Unknown realm: default
2013-07-02 14:39:15.651::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See StaticLoggerBinder for further details.
Tem 02, 2013 2:39:22 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.2.0 ( 20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0@11930) for context ''
Tem 02, 2013 2:39:22 PM com.sun.faces.config.ConfigureListener contextInitialized
WARNING: JSF1059: WARNING!  The com.sun.faces.verifyObjects feature is to aid developers not using tools.  It shouldn''t be enabled if using an IDE, or if this application is being deployed for production as it will impact application start times.
log4j:WARN No appenders could be found for logger (org.ajax4jsf.renderkit.ChameleonRenderKitFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See #noconfig for more info.
Tem 02, 2013 2:39:26 PM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment: 
java.lang.NoSuchMethodError: org.mortbay.jetty.annotations.AnnotationParser.parseAnnotations(Lorg/mortbay/jetty/webapp/WebAppContext;Ljava/lang/Class;Lorg/mortbay/jetty/plus/annotation/RunAsCollection;Lorg/mortbay/jetty/plus/annotation/InjectionCollection;Lorg/mortbay/jetty/plus/annotation/LifeCycleCallbackCollection;)V
    at com.sun.faces.vendor.Jetty6InjectionProvider.inject(Jetty6InjectionProvider.java:93)
    at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:695)
    at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:572)
    at javax.faces.FactoryFinder.access$500(FactoryFinder.java:140)
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1120)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:540)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:371)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:307)
    at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
    at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
2013-07-02 14:39:26.652::WARN:  Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@64dacd55{/,C:\Users\zmn\workspace\tracker-web\src\main\webapp}
java.lang.RuntimeException: java.lang.NoSuchMethodError: org.mortbay.jetty.annotations.AnnotationParser.parseAnnotations(Lorg/mortbay/jetty/webapp/WebAppContext;Ljava/lang/Class;Lorg/mortbay/jetty/plus/annotation/RunAsCollection;Lorg/mortbay/jetty/plus/annotation/InjectionCollection;Lorg/mortbay/jetty/plus/annotation/LifeCycleCallbackCollection;)V
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:540)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:371)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:307)
    at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
    at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.NoSuchMethodError: org.mortbay.jetty.annotations.AnnotationParser.parseAnnotations(Lorg/mortbay/jetty/webapp/WebAppContext;Ljava/lang/Class;Lorg/mortbay/jetty/plus/annotation/RunAsCollection;Lorg/mortbay/jetty/plus/annotation/InjectionCollection;Lorg/mortbay/jetty/plus/annotation/LifeCycleCallbackCollection;)V
    at com.sun.faces.vendor.Jetty6InjectionProvider.inject(Jetty6InjectionProvider.java:93)
    at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:695)
    at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:572)
    at javax.faces.FactoryFinder.access$500(FactoryFinder.java:140)
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1120)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
    ... 42 more

How is this caused and how can I solve it?

Here is the web.xml content:

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>WEB-INF/log4j.properties</param-value>
</context-param>
<welcome-file-list>
    <welcome-file>portal/html/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>
<!-- Special Debug Output for Development -->
<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>2</param-value>
</context-param>
<context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
    <param-value>true</param-value>
</context-param>
<!-- Richfaces -->
<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>tracker</param-value>
</context-param>
<!-- Richfaces end -->
<context-param>
    <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    <init-param>
        <param-name>createTempFiles</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>maxRequestSize</param-name>
        <param-value>512000</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<listener>
    <listener-class>com.omega.src.util.InitializeListener</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>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>loginPage.xhtml</welcome-file>
</welcome-file-list>
<login-config>
    <auth-method>BASIC</auth-method>
</login-config>

and dependencies in pom.xml content:

<dependencies>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.0</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.framework</groupId>
        <artifactId>richfaces-api</artifactId>
        <version>3.3.3.Final</version>
    </dependency>

    <dependency>
        <groupId>org.richfaces.framework</groupId>
        <artifactId>richfaces-impl</artifactId>
        <version>3.3.3.Final</version>
    </dependency>

    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-ui</artifactId>
        <version>3.3.3.Final</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.6.8.Final</version>
    </dependency>
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901.jdbc4</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.gmaps4jsf</groupId>
        <artifactId>gmaps4jsf-core</artifactId>
        <version>1.1.4</version>
    </dependency>
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>4.5.0</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6.12</version>
    </dependency>
</dependencies>
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
nudastack
  • 125
  • 1
  • 4
  • 18
  • skuntsel-- Sir, I've tried that configurations but it didn't work. I think, after adding JSF 2.x libs, some other plugins should be updated as well. Simply, I don't know which ones. – nudastack Jun 28 '13 at 14:24
  • Just ask a more specific question about the specific problem you're currently facing. Do you get an exception? Ask a question about exactly that exception. You will get an answer how to solve exactly that exception. Then you can advance to the next step. If it also causes an exception, then ask another new question about exactly that exception. Etcetera. You just can't put this all overgeneralized in a single question. This is not going to work in Stack Overflow, which is a Question & Answer site. – BalusC Jun 29 '13 at 20:01
  • I have edited my question and shared the exception that I got. What steps should I follow now? – nudastack Jul 01 '13 at 08:57
  • The community has voted 5 times to reopen the question. Your question is now reopened. As to the exception, this may happen if you're mixing multiple JSF impls/versions. As per the stacktrace, Mojarra is currently being used (whereas you previously used MyFaces). Perhaps you've still some MyFaces artifacts roaming around? Mojarra cannot find its own `FacesContext` anywhere, it returned `null` and caused this NPE. Please list the libraries you're currently using in webapp's runtime classpath. Please also list the JSF related configuration entries you currently have in webapp's `web.xml`. – BalusC Jul 01 '13 at 12:09
  • Just edit your question. – BalusC Jul 01 '13 at 13:16
  • The pom.xml and web.xml files that I have shared are the original working files in my app. However, when I replaced the JSF-Facelets 1.1.14 by JSF 2.x libs, the app threw the NPE as I shared before. Here, which libs should I remove and by which libs should I replace? – nudastack Jul 01 '13 at 14:17
  • You should remove Facelets 1.x and replace JSF (MyFaces) 1.2 by JSF 2.0. Your pom.xml still shows the old config. – BalusC Jul 01 '13 at 14:46
  • I did the same as you told but there are lots of exception. I updated the pom.xml and exceptions in the question above. What could be the cause of that many exceptions? – nudastack Jul 02 '13 at 11:58
  • One exception at a time, please. As commented before, just investigate and fix the first one occurring. It might as well magically fix all subsequent exceptions because they can be caused by the first exception. If you get a new one afterwards, then just post a new question about exactly that exception. The current one of `java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener` is rather easy. I will post an answer. – BalusC Jul 02 '13 at 12:01
  • Okay, I got it. I really appreciate your concern. – nudastack Jul 02 '13 at 12:06
  • Please do not change an existing question if you have a new question. It would make all answers completely worthless and confusing for case someone else stumbles upon your question in the future. As said, **ask a new question for every new question**. This is a question & answer site, not a chat box or a legacy discussion forum or so. They only end up in a mess where nobody can find true answers. – BalusC Jul 02 '13 at 17:03

1 Answers1

0

java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

As the package name hints, this is a MyFaces-specific class which is obviously not available anymore when you replace MyFaces 1.2 by Mojarra 2.0 instead of MyFaces 2.0.

This class is usually been referenced as <listener> entry in webapp's web.xml. If you remove the whole <listener> entry from web.xml, then this exception should disappear. You usually don't need to explicitly declare one yourself as this is already registered in the TLD file. However, Jetty has some bugs with that and you'd need to explicitly register it yourself. For Mojarra, that would be:

<listener>
   <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener> 

An alternative is to upgrade to MyFaces 2.0 instead of Mojarra 2.0. The same listener class is present over there.

See also:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • I replaced the old entry with the Mojarra but it caused other exception that I shared above. – nudastack Jul 02 '13 at 12:53
  • I tried the alternative way to upgrade to MyFaces 2.1.12 and kept the old . The application compiled without any error but when I ran it on browser nothing appeard. Do I have to add any other plugin with Myfaces 2.1.12? – nudastack Jul 02 '13 at 14:14
  • Your current problem is solved. You're not facing the exception anymore. Your current question is answered. Press `Ask Question` button to ask a new question. – BalusC Jul 02 '13 at 14:16
  • In the meanwhile, carefully read http://stackoverflow.com/questions/4441713/migrating-from-jsf-1-2-to-jsf-2-0/4532870#4532870 It might as well just be answered over there. – BalusC Jul 02 '13 at 14:16
  • Since you're new here, please don't forget to mark the answer accepted whenever it has helped (most) in solving the concrete problem. See also [How does accepting an answer work?](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235) Don't forget to do the same for [questions you asked previously](http://stackoverflow.com/users/2160999/nudastack?tab=questions), whenever applicable. – BalusC Jul 02 '13 at 17:07
  • Sorry for inconvenience Sir. I just checked the answer. – nudastack Jul 02 '13 at 20:07