web.xml not found in Java EE7 project

user2733757 picture user2733757 · Jul 14, 2015 · Viewed 7.5k times · Source

I'm doing a project in eclipse with JSF 2.2 and Servlet 3.1 (Java EE7). The first problem I had was a error in the pom.xml in line:

<packaging>war</packaging>

Error: web.xml is missing and is set true.

I researched on the internet and added the following lines in my pom.xml

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>    
    </configuration>
</plugin>

After that the error was gone, but when running the project get the error:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

I searched the Internet again and put the following lines in pom.xml

<dependency>    
    <groupId>jstl</groupId> 
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

The problem solved, only when access for example:

http://localhost:8080/MeuSistema/Login.jsf

(I put mapped as jsf to inves xhtml)

He changes the jsf by jsp stating the following:

HTTP Status 404 - /MeuSistema/Login.jsp

Out of curiosity changing the .jsf to .xhtml to see if opened at least the file, it returns the following:

HTTP Status 404 - Not Found /Login.xhtml in ExternalContext as a Resource

I also found this alternative to force to read the web.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <webxml>src/main/webapp/WEB-INF/web.xml</webxml>
        <warSourceDirectory>src/main/webapp/</warSourceDirectory>
    </configuration>
</plugin>

But the problems remain the same.

Follow my pom.xml and web.xml:

http://pastebin.com/43nqctAn

http://pastebin.com/GbqR9j9v

Well, it seems that is not reading the web.xml. Funny that in not of any console error.

What can be wrong? Thanks for attention.

Answer

user2733757 picture user2733757 · Jul 17, 2015

Solved - just deleted folders within my project .metada .project .settings .classpath

Thanks