Mohan Raj
Mohan Raj

Reputation: 590

java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet

I am getting this error, when executing JSF and PrimeFaces.

I have included these jars,

in the WEB-INF/lib folder.

Is there any jar I am missing?

Upvotes: 14

Views: 79655

Answers (9)

Prerit Jain
Prerit Jain

Reputation: 200

I added jsf 2.0 & mojarra 2.0.3-fcs in POM and it fixed my problem.

     <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.4.0</version>
    </dependency>

Upvotes: 2

Hetal Rachh
Hetal Rachh

Reputation: 1543

Adding below jars to path ..WebContent\WEB-INF\lib and a maven update solved the problem.

  • jsf-api

  • jsf-impl

Upvotes: 0

Janko Livić
Janko Livić

Reputation: 54

  1. Download JAR's from here: http://myfaces.apache.org/download.html

  2. Copy them to TOMCAT lib directory.

  3. Add to Tomcat web.xml these lines from screenshot: listener

Upvotes: 0

MAc
MAc

Reputation: 29

I had a similar issue and solved after running Maven Update a couple of times when it finally solved the issue. Running only once was not enough because the jar file was still corrupt so you need to make sure it opens with any compression tool like winzip or gzip.

Upvotes: -1

mr_djay619
mr_djay619

Reputation: 39

You can also do this, which solved my problem.
Right click on your project->properties->project facets->java server faces.

Then if the disabled library configuration option has selected, then change it to user library and then add mojarra's latest version and press OK button and try run the project again...

It should help.

Upvotes: 1

sijo jose
sijo jose

Reputation: 2207

Right click on project properties and follow below steps

"Project Properties" --> "Deployment Assembly", adding "Java Build Path Entries" ->jsf 2.0 (mojarra 2.0.3-fcs) solved my problems

Upvotes: 4

chandan burnwal
chandan burnwal

Reputation: 281

Right click on project properties and follow below steps

"Project Properties" --> "Deployment Assembly", adding "Java Build Path Entries" -> "Maven Dependencies" solves the problem!

Upvotes: 28

comitatenses
comitatenses

Reputation: 15

If you tried to convert your simple java project to web project using maven and changing specificications from project facets, you won't get a compile error but when you start deployment you can see this error message.

to solve this think of it. This is a web project and needs to deploy as a war file (or ear).

change packaging spec to war in your pom.xml then compile maven again.

Upvotes: 0

Omar
Omar

Reputation: 1440

Apparently, you're not missing anything else. Just try to do the following:

  1. Ensure that the necessary jars exist in the "lib" project folder;
  2. Do clean & build;

In the end, you should find those included jars, available within the "build" project folder.

Upvotes: 10

Related Questions