Java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet, tomcat does not see javaee-api-7.0-b83.jar

I am trying to run sample guessnumber-jsf from a Java EE tutorial. It is here: https://svn.java.net/svn/javaeetutorial~svn

There are no dependencies in pom.xml. Thus, the output file does not have a .jar file. When I try to put javaee-api-7.0-b83.jar inside tomcat / lib or WEB-INF / lib / javaee-api-7.0-b83.jar nothing changes.

When i try to open

local: 8080 / guessnumber-jsf / person / greeting.xhtml

I get a ClassNotFoundException. Where can I get a list of cans that I need for a guide for individuals? How can i connect them?

+4
source share
4 answers

You cannot put this Java EE jar in Tomcat and expect it to magically turn into a Java EE server.

This particular banner contains only APIs for links (for example, "headers" in C / C ++ terminology). It does not contain any implementation.

The easiest thing to do is to deliver Tomcat and download TomEE. Optionally download GlassFish.

All of them will contain all the necessary functionality, and nothing should be in WEB-INF / lib. (if Maven put Java EE 6 GAV depending on the amount provided in your pom).

+4
source

If you are using a Maven project, you can fix this error by adding the following dependency:

<dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.2.7</version> </dependency> 
+3
source

Adding to Mike Brown's answer, Java EE 6 GAV for a web profile:

 <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>6</version> <scope>provided</scope> </dependency> 

In particular, pay attention to the scope: "provided." This means that your Maven project will be associated with this, but it expects your runtime to have implementations. For TomEE, GlassFish, JBoss AS 7.x, etc. It really is.

+1
source

In your classpath (.classpath) make sure you have an entry like

 <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> 
0
source

All Articles