Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference/Equality of com.sun.faces > jsf-impl and org.glassfish > javax.faces (2.2.4)

Tags:

maven

jsf-2

In my JSF2 application I have faced a NPE in Primefaces (5.1) autocomplete at

org.primefaces.component.autocomplete.AutoCompleteRenderer .encodeSuggestionsAsList(AutoCompleteRenderer.java:492)

I have solved my problem by replacing the maven dependency

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.2.4</version>
</dependency>

by

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

This is confusing me.

Searching for the projects homepages I found these maven repositories:

http://mvnrepository.com/artifact/com.sun.faces/jsf-impl/2.2.4
http://mvnrepository.com/artifact/org.glassfish/javax.faces/2.2.4

They both claim the same description and reference the same URL as Homepage:

Description: Oracle's Implementation Of The JSF 2.2 Specification (2.2.4)
HomePage: http://java.sun.com/javaee/javaserverfaces/

Can someone explain the difference? Shouldn't the be exactly the same?

Hint: I know about the history of sun and Oracle. ;)

like image 613
ChristophS Avatar asked Jan 14 '15 12:01

ChristophS


1 Answers

The com.sun.faces:jsf-impl contains only the implementation (Mojarra). It lacks the API. You'd need a com.sun.faces:jsf-api along it.

The org.glassfish:javax.faces is the single-JAR bundle containing both API and impl (you can also see it at the file size).

As to your concrete problem when using only the jsf-impl, apparently you forgot the jsf-api, or you relied on javax:javaee-web-api while actually using a non-Java EE container like Tomcat.

like image 93
BalusC Avatar answered Jan 03 '23 10:01

BalusC