4
votes

I am having some error problems with my java code.

I have the following Code:

<html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:p="http://primefaces.org/ui"
 xmlns:pe="http://primefaces.org/ui/extensions"
 xmlns:s="http://www.sensap.eu/jsf"
 xmlns:c="http://java.sun.com/jsp/jstl/core"
 xmlns:dialogs="http://java.sun.com/jsf/composite/components/dialogs"
 xmlns:widgets="http://java.sun.com/jsf/composite/components/widgets">

When I compile the code it is giving me the following error:

No library found for namespace http://java.sun.com/jsf/composite/components/dialogs No library found for namespace http://java.sun.com/jsf/composite/components/widgets

I tried to check if the pom.xml is ok but from my end it looks fine. I don't know what to do next!!!

3

3 Answers

5
votes

Those http://java.sun.com/jsf/composite/* namespaces don't refer to external libraries. So your Maven configuration is actually irrelevant. Those http://java.sun.com/jsf/composite/* namespaces refer to the so-called composite components which are actually XHTML files in the /resources folder of your own webapp which in turn use <cc:interface><cc:implementation> declarations.

Given the namespaces, you should have something like:

Web Pages
 |-- resources
 |    |-- components
 |    |    |-- dialogs
 |    |    |    |-- somedialog.xhtml
 |    |    |    `-- otherdialog.xhtml
 |    |    `-- widgets
 |    |         |-- somewidget.xhtml
 |    |         `-- otherwidget.xhtml
 :    :

If you actually have them and your webapp runs correctly with those composites, then it's just Netbeans itself who's not being smart enough to see them and giving a false error. Upgrading Netbeans and/or reporting the issue to Netbeans guys should solve it.

1
votes

This is, in my opinion, a Maven/Netbeans intetgration problem. Netbeans should infer the neccesary Frameworks from your maven dependencies. Frameworks is a propietary Netbeans mechanism, that affects how your opened files will be processed. Open your project properties in netbeans, there is an option called "Frameworks". In your case, i guess, the list may be empty. Try to add the JavaServer faces framework as shown in attached picture.enter image description here

In case you find some problem adding the framework read this link Netbeans framework issue

1
votes

Do not forget to also migrate the namespace in your composite components:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://xmlns.jcp.org/jsf/composite">
  <cc:interface>
  </cc:interface> 
  ...