3
votes

I am using Netbeans 8.02 which seems to understand the composite component it helped me create. It is in the folder /resources/ezcomp (the default Nebeans uses for this) and looks like this:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:cc="http://xmlns.jcp.org/jsf/composite"
  xmlns:p="http://primefaces.org/ui"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:f="http://xmlns.jcp.org/jsf/core">

<!-- INTERFACE -->
<cc:interface>
    <cc:attribute name="pobject"
                  type="test.database.UserItem"
                  required="true" />
</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
    ...

When I edit a page to use the component, NetBeans has it in its code-completion data base, and it creates an xmlns reference on the page that looks like this.

xmlns:ezcomp="http://xmlns.jcp.org/jsf/composite/ezcomp"

The problem is when Mojarra 2.1.6 (Glassfish 3) encounters this it puts up a message:

Warning: This page calls for XML namespace 
http://xmlns.jcp.org/jsf/composite/ezcomp declared with 
prefix ezcomp but no taglibrary exists for that namespace.

Last time I was doing this the URL was java.sun.com so I guess the industry moved on whilst I was away. If I change the URL to use java.sun.com it turns into Null pointer exception.

Anyone have ideas on how to fix this?

1

1 Answers

2
votes

The http://xmlns.jcp.org/jsf/* namespace is new since JSF 2.2. Those warnings suggest that you're actually using JSF 2.0/2.1, or have configured your project to use JSF 2.0/2.1.

If you're not using/targeting JSF 2.2, then you should not be using the JSF 2.2-introduced namespace at all. In JSF 2.0/2.1 the XML namespace is http://java.sun.com/jsf/* like below.

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:cc="http://java.sun.com/jsf/composite"
>

If you're confident that you're actually using JSF 2.2, then you need to configure the targeted JSF version somewhere in project properties. In Eclipse you can find it in Project Facets. The below picture shows version 2.0. You should change that to 2.2 then.

enter image description here

If you can't select JSF 2.2, then the IDE itself most likely needs an update. In case of Eclipse, JSF 2.2 support was added in WTP 3.5 which is introduced in Eclipse 4.4 Luna for first.

See also: