You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/11 15:07:45 UTC

[1/3] tomee git commit: Fix the ClassCastException when the interfaces can't be loaded - embedded or application composer for instance

Repository: tomee
Updated Branches:
  refs/heads/master 004ad5118 -> 1ee33d7e9


Fix the ClassCastException when the interfaces can't be loaded - embedded or application composer for instance


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/c17b93cb
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/c17b93cb
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/c17b93cb

Branch: refs/heads/master
Commit: c17b93cb644bc7cbdd463d59ccfbf6a08998553f
Parents: 678c920
Author: Jean-Louis Monteiro <je...@gmail.com>
Authored: Tue Dec 11 13:04:59 2018 +0100
Committer: Jean-Louis Monteiro <je...@gmail.com>
Committed: Tue Dec 11 13:04:59 2018 +0100

----------------------------------------------------------------------
 .../java/org/apache/openejb/cdi/ManagedSecurityService.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/c17b93cb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
index a7346fe..1532f71 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
@@ -56,11 +56,19 @@ public class ManagedSecurityService implements org.apache.webbeans.spi.SecurityS
                 try {
                     final Class<?> clazz = loader.loadClass(apiInterface.trim());
                     interfaceList.add(clazz);
+
                 } catch (NoClassDefFoundError | ClassNotFoundException e) {
+
                     // TODO: log severe error here with guidance
                 }
             }
 
+            // not sure if we should do that, or simply check if we can't load the classes before
+            // and then skip the proxy creation and set the useWrapper to false.
+            if (interfaceList.isEmpty()) {
+                interfaceList.add(java.security.Principal.class);
+            }
+
             proxy = Principal.class.cast(Proxy.newProxyInstance(loader, interfaceList.toArray(new Class[0]), new InvocationHandler() {
                 @Override
                 public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {


[2/3] tomee git commit: Add some debugging information on the APIs not found

Posted by jl...@apache.org.
Add some debugging information on the APIs not found


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/36e426e7
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/36e426e7
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/36e426e7

Branch: refs/heads/master
Commit: 36e426e7e8cdfb947cf315a1130a5a43aad3b7f2
Parents: c17b93c
Author: Jean-Louis Monteiro <je...@gmail.com>
Authored: Tue Dec 11 16:06:43 2018 +0100
Committer: Jean-Louis Monteiro <je...@gmail.com>
Committed: Tue Dec 11 16:06:43 2018 +0100

----------------------------------------------------------------------
 .../openejb/cdi/ManagedSecurityService.java     | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/36e426e7/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
index 1532f71..c5aba9d 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/ManagedSecurityService.java
@@ -19,23 +19,25 @@ package org.apache.openejb.cdi;
 
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.SecurityService;
+import org.apache.openejb.util.Join;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 import org.apache.webbeans.config.WebBeansContext;
 
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
+import java.lang.reflect.*;
 import java.security.Principal;
 import java.security.PrivilegedActionException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
 public class ManagedSecurityService implements org.apache.webbeans.spi.SecurityService {
+
     private final org.apache.webbeans.corespi.security.ManagedSecurityService delegate = new org.apache.webbeans.corespi.security.ManagedSecurityService();
 
+    private final Logger logger = Logger.getInstance(LogCategory.OPENEJB_CDI, ManagedSecurityService.class.getName());
+
     private final boolean useWrapper;
     private Principal proxy = null;
 
@@ -51,6 +53,7 @@ public class ManagedSecurityService implements org.apache.webbeans.spi.SecurityS
                     .getProperty("org.apache.webbeans.component.PrincipalBean.proxyApis", "org.eclipse.microprofile.jwt.JsonWebToken").split(",");
 
             List<Class> interfaceList = new ArrayList<>();
+            List<String> notFoundInterfaceList = new ArrayList<>();
 
             for (final String apiInterface : apiInterfaces) {
                 try {
@@ -58,11 +61,16 @@ public class ManagedSecurityService implements org.apache.webbeans.spi.SecurityS
                     interfaceList.add(clazz);
 
                 } catch (NoClassDefFoundError | ClassNotFoundException e) {
-
-                    // TODO: log severe error here with guidance
+                    notFoundInterfaceList.add(apiInterface);
                 }
             }
 
+            if (!notFoundInterfaceList.isEmpty()) {
+                logger.info("Some Principal APIs could not be loaded: {0} out of {1} not found",
+                        Join.join(",", notFoundInterfaceList),
+                        Join.join(",", Arrays.asList(apiInterfaces)));
+            }
+
             // not sure if we should do that, or simply check if we can't load the classes before
             // and then skip the proxy creation and set the useWrapper to false.
             if (interfaceList.isEmpty()) {


[3/3] tomee git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tomee

Posted by jl...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tomee


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1ee33d7e
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1ee33d7e
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1ee33d7e

Branch: refs/heads/master
Commit: 1ee33d7e962d4c12477d3a331a443a7008f116c4
Parents: 36e426e 004ad51
Author: Jean-Louis Monteiro <je...@gmail.com>
Authored: Tue Dec 11 16:07:35 2018 +0100
Committer: Jean-Louis Monteiro <je...@gmail.com>
Committed: Tue Dec 11 16:07:35 2018 +0100

----------------------------------------------------------------------
 examples/mp-config-example/README.md            | 46 ++++++++++
 examples/mp-config-example/pom.xml              | 92 ++++++++++++++++++++
 .../org/superbiz/config/PropertiesRest.java     | 80 +++++++++++++++++
 .../src/main/resources/META-INF/beans.xml       |  0
 .../META-INF/microprofile-config.properties     |  3 +
 .../org/superbiz/config/PropertiesRestTest.java | 53 +++++++++++
 .../src/test/resources/arquillian.xml           | 30 +++++++
 examples/mp-faulttolerance-retry/pom.xml        | 44 +++++++---
 examples/pom.xml                                |  1 +
 9 files changed, 339 insertions(+), 10 deletions(-)
----------------------------------------------------------------------