Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no library found for namespace http://omnifaces.org/ui #4976

Closed
NicolaIsotta opened this issue Nov 16, 2022 · 9 comments · Fixed by #6160
Closed

no library found for namespace http://omnifaces.org/ui #4976

NicolaIsotta opened this issue Nov 16, 2022 · 9 comments · Fixed by #6160
Labels
enterprise [ci] enable enterprise job Java EE/Jakarta EE [ci] enable enterprise job kind:bug Bug report or fix

Comments

@NicolaIsotta
Copy link

NicolaIsotta commented Nov 16, 2022

Apache NetBeans version

Apache NetBeans 16 release candidate

What happened

Since omnifaces 3.0, omnifaces taglib are not recognized by the IDE.

How to reproduce

Create java / jakarta EE (at least 8) web project.
Add omnifaces 3 (if java/jakarta EE 8) or 4 (if jakarta EE >= 9) dependency
Create xhtml page and add xmlns:o="http://omnifaces.org/ui" to the namespaces declaration
omnifaces

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11

JDK

Java: 11.0.13; Java HotSpot(TM) 64-Bit Server VM 11.0.13+10-LTS-370

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

Related:
omnifaces/omnifaces#489
omnifaces/omnifaces#442
https://issues.apache.org/jira/browse/NETBEANS-3611
https://issues.apache.org/jira/browse/NETBEANS-3150

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@NicolaIsotta NicolaIsotta added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Nov 16, 2022
@NicolaIsotta
Copy link
Author

Ok find the cause.
In ConfigManager, jakarta ee taglibs are not handled:

if (JAVAEE_SCHEMA_DEFAULT_NS.equals(documentNS)) {
Attr version = (Attr)
documentElement.getAttributes().getNamedItem("version");
Schema schema;
if (version != null) {
String versionStr = version.getValue();
if ("2.3".equals(versionStr)) {
if ("facelet-taglib".equals(documentElement.getLocalName())) {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACELET_TAGLIB_22);
} else {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_23);
}
} else if ("2.2".equals(versionStr)) {
if ("facelet-taglib".equals(documentElement.getLocalName())) {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACELET_TAGLIB_22);
} else {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_22);
}
} else {
throw new ConfigurationException("Unknown Schema version: " + versionStr);
}
DocumentBuilder builder = getBuilderForSchema(schema);
if (builder.isValidating()) {
builder.getSchema().newValidator().validate(domSource);
returnDoc = ((Document) domSource.getNode());
} else {
returnDoc = ((Document) domSource.getNode());
}
} else {
// this shouldn't happen, but...
throw new ConfigurationException("No document version available.");
}
} else if (JAVAEE_SCHEMA_LEGACY_DEFAULT_NS.equals(documentNS)) {
Attr version = (Attr)
documentElement.getAttributes().getNamedItem("version");
Schema schema;
if (version != null) {
String versionStr = version.getValue();
if ("2.0".equals(versionStr)) {
if ("facelet-taglib".equals(documentElement.getLocalName())) {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACELET_TAGLIB_20);
} else {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_20);
}
} else if ("2.1".equals(versionStr)) {
if ("facelet-taglib".equals(documentElement.getLocalName())) {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACELET_TAGLIB_20);
} else {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_21);
}
} else if ("1.2".equals(versionStr)) {
schema = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_12);
} else {
throw new ConfigurationException("Unknown Schema version: " + versionStr);
}
DocumentBuilder builder = getBuilderForSchema(schema);
if (builder.isValidating()) {
builder.getSchema().newValidator().validate(domSource);
returnDoc = ((Document) domSource.getNode());
} else {
returnDoc = ((Document) domSource.getNode());
}
} else {
// this shouldn't happen, but...
throw new ConfigurationException("No document version available.");
}
} else {
DOMResult domResult = new DOMResult();
Transformer transformer = getTransformer(documentNS);
transformer.transform(domSource, domResult);
// copy the source document URI to the transformed result
// so that processes that need to build URLs relative to the
// document will work as expected.
((Document) domResult.getNode())
.setDocumentURI(((Document) domSource
.getNode()).getDocumentURI());
Schema schemaToApply;
if (FACES_CONFIG_1_X_DEFAULT_NS.equals(documentNS)) {
schemaToApply = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACES_11);
} else if (FACELETS_1_0_DEFAULT_NS.equals(documentNS)) {
schemaToApply = DbfFactory.getSchema(servletContext, DbfFactory.FacesSchema.FACELET_TAGLIB_20);
} else {
throw new IllegalStateException();
}
DocumentBuilder builder = getBuilderForSchema(schemaToApply);
if (builder.isValidating()) {
builder.getSchema().newValidator().validate(new DOMSource(domResult.getNode()));
returnDoc = (Document) domResult.getNode();
} else {
returnDoc = (Document) domResult.getNode();
}
}

Solution:

  • add mojarra-4.0 as an external module (I don't really know how to do this)
  • refactor the code in the ConfigManager by calling the new mojarra function DbfFactory.getSchema(ServletContext servletContext, String documentNS, String version, String localName):

https://github.com/eclipse-ee4j/mojarra/blob/b9f62a28133b639a1f1d1f23de02fc7027e8aa23/impl/src/main/java/com/sun/faces/config/manager/DbfFactory.java#L320-L331

Any hint on how to go on?

@fcorneli
Copy link
Contributor

fcorneli commented Dec 9, 2022

I am having the same issue for the PrimeFaces library on NetBeans 16.

xmlns:p="http://primefaces.org/ui"

Since I have errors all over the place within my projects due to this, it basically renders 16 final unusable.
Funny how such a major regression made it within 16 final.

@morvael
Copy link

morvael commented Jan 4, 2023

Related to this (perhaps) is lack of support for new non-URL URNs for JSF 4.0:
jsf4
See jakartaee/faces#1553

And I think related to that is the inability to load facelet 4.0 taglib (also "No library found" error):

<facelet-taglib version="4.0"
                xmlns="https://jakarta.ee/xml/ns/jakartaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facelettaglibrary_4_0.xsd">
                ...

@LouisCollet
Copy link

Same situation in NB 17rc3
What makes Jakarta EE unusable for Jakarta Faces 4.0
Are we to understand that NB no longer supports JSF?

@geertjanw
Copy link
Member

You are to understand that NB supports everything you provide support for at github.com/apache/netbeans.

@mbien mbien added Java EE/Jakarta EE [ci] enable enterprise job enterprise [ci] enable enterprise job labels Feb 14, 2023
@LouisCollet
Copy link

LouisCollet commented Feb 14, 2023 via email

@geertjanw
Copy link
Member

Appreciated, thanks, @LouisCollet.

@fcorneli
Copy link
Contributor

Tried out NetBeans version 17-RC3. Unfortunately this issue is still present.
On a Java EE 8 project NetBeans does not recognize xmlns:p="http://primefaces.org/ui", i.e., red all over the place. Same remark for a Quarkus project using JSF.

On a Jakarta EE 10 project NetBeans does not recognize xmlns:h="jakarta.faces.html", but there xmlns:p="http://primefaces.org/ui" is OK.
Could somebody have a look at this before version 17? Such basic functionality should not get broken.

@mbien mbien removed the needs:triage Requires attention from one of the committers label Feb 15, 2023
@fcorneli
Copy link
Contributor

fcorneli commented Mar 1, 2023

Strange, version 17 still has this issue, but a build from master not:

ant -Dcluster.config=enterprise build
ant tryme

Here NB can resolve the following without problem:

But fails on

  • xmlns:h="jakarta.faces.html"

Using:
https://github.com/e-Contract/enterprise-jsf
as test project.

mmm... opening the same project afterwards with version 17 instead of master, gives the same results as above. pfff... I don't get it.

@mbien mbien removed the enterprise [ci] enable enterprise job label Jul 9, 2023
@mbien mbien linked a pull request Jul 9, 2023 that will close this issue
@mbien mbien added the enterprise [ci] enable enterprise job label Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enterprise [ci] enable enterprise job Java EE/Jakarta EE [ci] enable enterprise job kind:bug Bug report or fix
Projects
Development

Successfully merging a pull request may close this issue.

6 participants