How to fix java rest API? Keep getting 404's - java

I followed this tutorial (https://programmerscuriosity.com/2016/09/27/simple-jersey-example-with-intellij-idea-ultimate-and-tomcat/) to create a simple Rest API in java with tomcat, but I keep getting a 404 error, and I can't see where I went wrong.
I'm guessing the error is some where in my configuration.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.demo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>com.demo</groupId>
<artifactId>SimpleJersey</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</dependency>
</dependencies>
<properties>
<jersey.version>2.23.2</jersey.version>
</properties>
</project>
MyResource.java
package demo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
* Created by marom on 27/09/16.
*/
#Path("myresource")
public class MyResource {
/**
* Method handling HTTP GET requests. The returned object will be sent
* to the client as "text/plain" media type.
*
* #return String that will be returned as a text/plain response.
*/
#GET
#Produces(MediaType.TEXT_PLAIN)
public String getIt() {
return "Got it!";
}
}
My project structure
https://imgur.com/8b4xPP6
Added ressources to the WEB-INF
https://imgur.com/JKtmtNu
Tomcat configuration
https://imgur.com/ldJtCLf
https://imgur.com/Qpxys3x
404 from localhost:8080/rest/myresource
https://imgur.com/UIPMqm1

As your MyResource.java resides in demo package. You need to change the package mapping in web.xml
(param-value of jersey.config.server.provider.packages)
updated web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>demo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>

Related

404 Error using Jersey and Apache Tomcat for Web Api

I am trying to play around with Eclipse/Java and I am making a Dynamic Web Project in Eclipse. I have followed tutorials online and looked at several other Stackoverflow posts, but i'm still having the same problem.
When I run my server and try to hit my endpoint /test, I get a 404 error. Here is my code:
My Java Class:
package TestPackage;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
#Path("/test")
public class Test {
#GET
public String Hello() {
return "hello";
}
}
My Pom.xml:
<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>RestDemo</groupId>
<artifactId>RestDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.25</version>
</dependency>
</dependencies>
</project>
I read that if you're using Jersey 2.+, you wouldn't have to fiddle around with your web.xml, so it's the standard format:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>RestDemo</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
So when I try to call http://localhost:8080/RestDemo/test, I get a 404 error. Any idea what's going on?
In Servlet 2.5 environment, you have to explicitly declare the Jersey container Servlet in your Web application's web.xml deployment descriptor file.
As per https://jersey.java.net/documentation/latest/user-guide.html#deployment.servlet
Example 4.10. Hooking up Jersey as a Servlet
<web-app>
<servlet>
<servlet-name>MyApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
...
</init-param>
</servlet>
...
<servlet-mapping>
<servlet-name>MyApplication</servlet-name>
<url-pattern>/myApp/*</url-pattern>
</servlet-mapping>
...
</web-app>

SpringMVC JSP: Method not called on initial page load

I want SpringMVC to call a method when my-site.com loads that adds some attributes to the model just like my other working methods do. I originally used this annotation:
#RequestMapping(value = "/", method = RequestMethod.GET)
The problem is, Spring ignores the method for some reason, yet allows everything else to work. As a work-around I have to declare it like this:
#RequestMapping(value = "/unnecessary-page", method = RequestMethod.GET)
and put a link to my-site.com/unnecessary-page on the main page. This is very strange. How would I get this to work the way I originally intended?
edit: this is the web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!--Dispatcher Config-->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--Application Config-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>com.web.search.context.ContextFinalizer</listener-class>
</listener>
</web-app>
#RequestMapping(value = "/*")
Try to remove this line. I think this is your problem, hope so.
index.jsp
<html>
<body>
<h2>${mgs}</h2>
</body>
</html>
HomepageController.java
#Controller
public class HomePageController {
#RequestMapping(value = "/", method = RequestMethod.GET)
public String getHomePage(ModelMap map) {
map.addAttribute("mgs", "Hello, Have a nice day");
return "index";
}
}
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
">
<!-- Use #Component annotations for bean definitions -->
<context:component-scan base-package="ltvnc.java.lichking.*" />
<!-- Use #Controller annotations for MVC controller definitions -->
<mvc:annotation-driven />
<!-- View resolver -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
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>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
pom.xml
<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>ltvnc.java.lichking</groupId>
<artifactId>example</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>example Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>4.1.1.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<finalName>example</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
it will display "Hello, have a nice day" when you start your app with url http://localhost:7080/example/

How to avoid application name in URL - RESTEasy Java 8

I am very new to RESTEasy and the Java EE stack. I used to use the Spring framework and its modules instead. Today I thought to get familiar with Java EE's RESTEasy and dig through a list of problems so far, but finally my app started and I have also figured out that I need to type the url like this:
http://localhost:8080/com.maciej/message/asdasda
instead of:
http://localhost:8080/message/asdasda
as I did in spring rest
I wonder why is that? What should I configure to avoid typing com.maciej to the url?
Here are my config files, if you need more please let me know in comments and I will paste them.
web.xml
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>RestEasy sample Web Application</display-name>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.maciej.MessageApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Application class:
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
public class MessageApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();
public MessageApplication() {
singletons.add(new MainRest());
}
#Override
public Set<Object> getSingletons() {
return singletons;
}
}
pom.xml
<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>com.maciej</groupId>
<artifactId>com.maciej</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>com.maciej Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.2.1.GA</version>
</dependency>
</dependencies>
<build>
<finalName>com.maciej</finalName>
</build>
</project>
I use JBoss 9.0.0.Beta as my application server.
Thanks!
You can add #ApplicationPath("/") in your application class and this should work

java.lang.NoClassDefFoundError: javax/ws/rs/core/Configuration

I am implementing rest easy web service and i am using jboss 4.0 but i am getting following exception...
java.lang.NoClassDefFoundError: javax/ws/rs/core/Configuration
my web.xml is
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>RestfulWebService</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- <servlet>
<servlet-name>HelloServlet</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet> -->
<!-- <servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>javax.ws.rs.core.Application</servlet-class>
</servlet> -->
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<!-- <context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param> -->
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.websevices.TestService</param-value>
</init-param>
</servlet>
<!-- <servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping> -->
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
It's easy to meet such error when migrating/copying dependencies from servlet based project to standalone. For servlet based project one usually needs dependency with scope = 'provided' relying that servlet provides implementation:
Dependency causing error:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
But for standalone projects there is no servlet implementation so you need to turn on copy javax.ws.rs-api to classpath. Usually you need just to remove <scope>provided</scope> line and have straightforward dependency:
Fixed dependency:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
From the Exception its clear that The class loader is not able to find the class Configuration (from javax/ws/rs/core/Configuration).
Please check classpath, corresponding JAR file and make sure that the class file exist.

java.lang.StackOverflowError Running JSF 2 example on Weblogic 12c

I followed the very basic tutorial found here example and cannot seem to get past the following error:
Error 500--Internal Server Error
java.lang.StackOverflowError
at weblogic.servlet.internal.ServletResponseImpl.addHeader(ServletResponseImpl.java:567)
at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
Pressing shift + F5 a couple times I can generate a slightly different stacktrace as follows:
Error 500--Internal Server Error
java.lang.StackOverflowError
at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:224)
at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:224)
Here is my 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"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>JavaServerFaces</display-name>
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
Here is the pom.xml
<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>com.example</groupId>
<artifactId>JavaServerFaces</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>JavaServerFaces Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</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>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<build>
<finalName>JavaServerFaces</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have exhausted several hours searching the web and constructing new projects with no luck. I understand that the StackOverflowError is produced from bad recursion calls and infinite loops, however I can't see this as the case here.
My current dev stack is eclipse juno, m2e-wtp, weblogic 12c, Java EE 6 using JSF 2.1
I am hoping it is something simple like a missing dependency or weblogic plugin in my pom.xml. Any help would me MUCH appreciated.
UPDATE 1: If I export the war file using eclipse (Right click the project -> Export -> WAR file) then manually deploy it via the weblogic admin counsel the app works as expected. More specifically the version of eclipse is the one from oracle (oepe-12.1.1.2.1-juno-distro-win32-x86_64.zip).
(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
Solved the problem! After adding JSF 2.1 in the pom.xml the JSF 2.1 checkbox was checked in project facets, however it did not add the faces-config.xml to the project. I simple created a new xml file named faces-config.xml under the webapp --> WEB-INF folder and added the following xml:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config 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" version="2.1">
<application></application>
</faces-config>
I Hope this helps others!

Categories

Resources