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

Mojarra 3.0.2 fails when a tag handler is missing a class. #5041

Closed
larsgrefer opened this issue Jan 26, 2022 · 7 comments
Closed

Mojarra 3.0.2 fails when a tag handler is missing a class. #5041

larsgrefer opened this issue Jan 26, 2022 · 7 comments
Labels

Comments

@larsgrefer
Copy link
Contributor

We noticed a strange error while working with Mojarra 3.0.2 and Omnifaces 4.0-M12:

The application startup fails with the following error in Mojarra:

java.lang.NoClassDefFoundError: jakarta/validation/ConstraintViolation
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[na:na]
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) ~[na:na]
	at com.sun.faces.util.Util.classHasAnnotations(Util.java:1255) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.application.ApplicationInstanceFactoryMetadataMap.onPut(ApplicationInstanceFactoryMetadataMap.java:54) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.application.ApplicationInstanceFactoryMetadataMap.onPut(ApplicationInstanceFactoryMetadataMap.java:27) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.util.MetadataWrapperMap.put(MetadataWrapperMap.java:78) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:285) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:391) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:341) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:276) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:232) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:309) ~[jakarta.faces-3.0.2.jar!/:3.0.2]
	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:207) ~[jakarta.faces-3.0.2.jar!/:3.0.2]

The handler class passed to com.sun.faces.util.Util.classHasAnnotations is org.omnifaces.taghandler.ValidateBean

Since both Mojarra and Omnifaces list jakarta.validation as an optional dependency and we are neither using <o:validateBean> nor <f:validateBean>, I'd expect this to not be an error.

I think this exception should be caught somewhere in FaceletTaglibConfigProcessor.

@mnriem
Copy link
Contributor

mnriem commented Jan 28, 2022

Please see if you can reproduce it using only core Mojarra 3.0.2.

@larsgrefer
Copy link
Contributor Author

@mnriem What exactly do you mean with "only core Mojarra"?

This issue arises when an optional dependency (in my case jakarta.validation) of an external tag library (in my case Omnifaces) is not present on the classpath.

@larsgrefer
Copy link
Contributor Author

I've created a small reproducer project here: https://github.com/larsgrefer/mojarra-5041

@BalusC
Copy link
Contributor

BalusC commented Jan 31, 2022

Yup, point taken, this is indeed unexpected.

I can tell from own experience that it didn't happen in some previous Mojarra version, so it has clearly regressed at some point.

@BalusC
Copy link
Contributor

BalusC commented Feb 20, 2022

Fixed for 2.3.next. I'll upmerge into 3.x and 4.x once PR is approved/merged.

Noted should be that I cannot come up with a simple integration test for this (as long as we keep using GlassFish it is).

arjantijms added a commit that referenced this issue Feb 20, 2022
#5041 fix deploy fail when optionally injectable class is not injectable
@mnriem
Copy link
Contributor

mnriem commented Feb 28, 2022

@BalusC if this is fixed for 3.0 please close it and create a separate issue for 4.0 linking this issue or add a 4.0 label to this one so it does not get lost.

@BalusC
Copy link
Contributor

BalusC commented Feb 28, 2022

Sorry, forgot to close this.

Already upmerged in 3.0 e879705
Already upmerged in 4.0 0c7e33a

@BalusC BalusC closed this as completed Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants