You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2024/07/15 20:22:43 UTC
(tomee) branch main updated: TOMEE-4355 - Avoid breaking arquillian and other TomEE use cases in case Mojarra is not present in the classpath.
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/main by this push:
new 3999ba5bd8 TOMEE-4355 - Avoid breaking arquillian and other TomEE use cases in case Mojarra is not present in the classpath.
3999ba5bd8 is described below
commit 3999ba5bd8a10a6ec0c5d819692d48a85b5a494f
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Mon Jul 15 22:22:34 2024 +0200
TOMEE-4355 - Avoid breaking arquillian and other TomEE use cases in case Mojarra is not present in the classpath.
---
.../java/org/apache/tomee/mojarra/TomEEMojarraService.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java
index 8f50ddcb26..98bf3dfb1e 100644
--- a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java
+++ b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java
@@ -16,7 +16,6 @@
*/
package org.apache.tomee.mojarra;
-import com.sun.faces.cdi.CdiExtension;
import org.apache.openejb.cdi.OptimizedLoaderService;
import org.apache.openejb.spi.Service;
import org.apache.tomee.mojarra.owb.OwbCompatibleCdiExtension;
@@ -28,8 +27,13 @@ import java.util.Properties;
public class TomEEMojarraService implements Service {
@Override
public void init(Properties props) throws Exception {
- // Replace Mojarra's CDI extension because it registers beans OWB can't proxy since mojarra 4.0.1
- // See https://github.com/eclipse-ee4j/mojarra/issues/5457
- OptimizedLoaderService.EXTENSION_REPLACEMENTS.put(CdiExtension.class.getName(), OwbCompatibleCdiExtension.class.getName());
+ try {
+ final Class<?> extension = Class.forName("com.sun.faces.cdi.CdiExtension");
+ // Replace Mojarra's CDI extension because it registers beans OWB can't proxy since mojarra 4.0.1
+ // See https://github.com/eclipse-ee4j/mojarra/issues/5457
+ OptimizedLoaderService.EXTENSION_REPLACEMENTS.put(extension.getName(), OwbCompatibleCdiExtension.class.getName());
+ } catch (ClassNotFoundException ignored) {
+
+ }
}
}