Supriti
Supriti

Reputation: 21

Unable to run web project after maven build

I am new to Maven. I am trying to build a web project using maven and eclipse kepler. But after I run maven build with clean install the .xhtml files are not inside the web-inf folder, which is ultimately giving resource not found error

My folder structure

web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>CassandraPrimefacesKunderaIntegration</display-name>
  <welcome-file-list>
    <welcome-file>home.xhtml</welcome-file>
  </welcome-file-list>
  <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>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

pom.xml without dependencies

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>CassandraPrimefacesKunderaIntegration</groupId>
  <artifactId>CassandraPrimefacesKunderaIntegration</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>CassandraPrimefacesKunderaIntegration</name>

  <url>http://maven.apache.org</url>

<build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>        
      </plugin>
    </plugins>
  </build>

when I am invoking maven build with clean install the target folder is like below

target folder structure

Deployment assembly -->

src/main/java -->WEB-INF/classes
src/main/resources -->WEB-INF/classes
src/main/webapp -->WEB-INF/classes

Now when I run the project from Tomcat (right click -->run as --> run on server) it is showing "resource not available" error

Upvotes: 1

Views: 1654

Answers (2)

Leonardo Leonardo
Leonardo Leonardo

Reputation: 463

First try a maven - update project, then clean and build your app again.

Upvotes: 1

Paras Pandey
Paras Pandey

Reputation: 11

I do not see deployment descriptor in your project structure. Check in Project Facets, if you have marked Dynamic Web module.

Upvotes: 0

Related Questions