Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9113527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:59:08+00:00 2026-06-17T03:59:08+00:00

I want to deploy my JSF2 app on tomcat using mvn tomcat:run . I

  • 0

I want to deploy my JSF2 app on tomcat using mvn tomcat:run. I did compile it correctly previously using the mvn clean install command.
Tomcat is saying to me INFO: Starting Coyote HTTP/1.1 on http-8080

I wonder if I did configure my welcome page correctly.
This is my web.xml:

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>Archetype Created Web Application</display-name>

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <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>home.xhtml</welcome-file>
    </welcome-file-list>


</web-app>

And this is my pom.xml just to double check that the artifactid is correct:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.bogus</groupId>
    <artifactId>jsf2_tutorial</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>jsf2_tutorial Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <repositories>
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net Repository for Maven</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.0-b03</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.0-b03</version>
            <scope>compile</scope>
        </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>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Just i am going to paste the last bit, the home.xhtml to make sure it is also correct:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Hello JSF 2!</title>
    </h:head>
    <h:body>
       #{welcome.message}
    </h:body>
</html>

The error when I navigate to the welcome page is:

HTTP status 500
In the url I notice I had a typo. Now I enter the correct URL but the problem is:

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

javax.servlet.ServletException: Class javax.faces.webapp.FacesServlet is not a Servlet
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Thread.java:662)

root cause

java.lang.ClassCastException: javax.faces.webapp.FacesServlet cannot be cast to javax.servlet.Servlet
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Thread.java:662)

    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.

Update

I got rid of the exception by removing the servlet-api dependency from the pom.xml

 <dependency>  <groupId>javax.servlet</groupId> 
 <artifactId>servlet-api</artifactId>  <version>2.5</version> 
 </dependency>

The page now loads but the message is not being displayed.
This is how the java part of this app looks like:

package org.bogus;
import javax.faces.bean.ManagedBean;

@ManagedBean(name = "welcome", eager = true)
public class WelcomeBean {
    public WelcomeBean() {
        System.out.println("WelcomeBean instantiated");
    }
    public String getMessage() {
        return "I'm alive!";
    }
}

This example is almost the same as in the official JSF tutorial at oracle: http://docs.oracle.com/javaee/6/tutorial/doc/gjaam.html

I included the <load-on-startup>1</load-on-startup> but still I don’t see the message in the console or in the page.
Maybe there is still something wrong with the configurations.
Any idea?

Update
I just included the faces-config.xml file under WEB-INF but still does not work:

<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is not required if you don't need any extra configuration. -->
<faces-config version="2.1"
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">

   <!-- Write your navigation rules here. -->

   <application>
        <locale-config>
            <default-locale>en</default-locale>
            <supported-locale>en</supported-locale>
        </locale-config>
   </application>

</faces-config>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:59:10+00:00Added an answer on June 17, 2026 at 3:59 am

    You’ve basically 2 problems:

    1. JSF2 requires a minimum of Servlet 2.5 (Tomcat 6 compatible), yet your web.xml is declared conform Servlet 2.3 (Tomcat 4 compatible). You should declare your web.xml to highest version compatible with the servletcontainer. Given that it’s Tomcat 6, which is a Servlet 2.5 container, declare it as Servlet 2.5 instead.

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app 
          xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5">
      
          <!-- Config here. -->
      
      </web-app>
      

      (yes, without the doctype!)


    2. @ManagedBean of Mojarra 2.1.0 doesn’t work on Tomcat and Jetty due to accidently inserted Glassfish-specific code in the annotation scanning code. See also issue 1937. You need to upgrade to at least Mojarra 2.1.1 (or just the currently available 2.1.17). An alternative is to manually register the managed bean in faces-config.xml, but that’s plain clumsy.


    Unrelated to the concrete problem, the @ManagedBean(eager=true) works on @ApplicationScoped only. Just omit it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a python app and I want to deploy it. I'm using Aptana
I want to deploy my django app using apache + mod_wsgi again. I seem
I want to deploy an app using Sinatra on Phusion Passenger w/ nginx. If
I want to deploy and run my Play! Framework app on EC2. I have
When I want to deploy my app to heroku (using git push heroku master),
I want to deploy a Play 2.0.4 app on Heroku using git push heroku
I want to deploy my Jax-WS2.2 based application on CloudFoundry tomcat instance. In my
I want to deploy a website the first time using Rails 3.2.1 with capistrano
I have a console application and I want to deploy/share it using some msi/setup.exe
I have finished developing my app and now I want to deploy it.. what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.