You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/02/01 16:26:25 UTC

[tomee] branch TOMEE-2408 created (now 58674b8)

This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a change to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git.


      at 58674b8  TOMEE-2408 - Fixed issue with ClassNotFound due to web.xml change to metadata-complete. Tomcat performs scanning on classes to find webapp annotations and this happened before adding the TomEE lib jars into the classloader.

This branch includes the following new commits:

     new 8af6ae2  TOMEE-2408 - Initial work to make MicroProfile deployment only when required.
     new 1a4e4ad  TOMEE-2408 - Removed all MP deployable endpoints. Rules required to activate them.
     new b86e492  TOMEE-2408 - Initial rules to figure out if MP Health is required.
     new 76f9140  TOMEE-2408 - Fixed CDI Scanning for MP in EAR deployments.
     new 766a662  TOMEE-2408 - Added MicroProfile to Plus and Plume.
     new fc9fa5d  TOMEE-2408 - Removed the MicroProfileExtension. Is not needed.
     new ba02c94  TOMEE-2408 - MicroProfileListener to removed duplicated endpoints and prevent servlet mapping clash.
     new de5a2ee  TOMEE-2408 - CDI scanning for additional libraries, skipping if to deploy only the related ejb module.
     new 173ffec  TOMEE-2408 - Exclude some libraries from scanning.
     new 19d2f26  TOMEE-2408 - Enable CDI for Tomcat TomEE webapp deployment.
     new fb13045  TOMEE-2408 - ApplicationComposer in Arquillian Remote with MP not supported yet.
     new ccc326f  TOMEE-2408 - Workaround for OpenAPI issue (GERONIMO-6690).
     new 8f0dacd  TOMEE-2408 - Readded MP libraries. Apparently they are needed in some cases.
     new 26d5b4e  TOMEE-2408 - Fixed NPE.
     new 3f59d38  TOMEE-2462 - Added test to verify servlets, default servlet and rest endpoints execution.
     new 58674b8  TOMEE-2408 - Fixed issue with ClassNotFound due to web.xml change to metadata-complete. Tomcat performs scanning on classes to find webapp annotations and this happened before adding the TomEE lib jars into the classloader.

The 16 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tomee] 03/16: TOMEE-2408 - Initial rules to figure out if MP Health is required.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit b86e49266b179b49ecea0d746e4bc3f7c5aa7822
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Fri Jan 18 23:14:07 2019 +0000

    TOMEE-2408 - Initial rules to figure out if MP Health is required.
---
 .../cdi/TomEEMicroProfileExtension.java            | 113 +++++++--------------
 1 file changed, 37 insertions(+), 76 deletions(-)

diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
index 2765395..3881cfb 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
@@ -18,6 +18,7 @@ package org.apache.tomee.microprofile.cdi;
 
 import org.apache.geronimo.microprofile.common.jaxrs.HealthChecksEndpoint;
 import org.apache.geronimo.microprofile.impl.health.cdi.CdiHealthChecksEndpoint;
+import org.apache.geronimo.microprofile.impl.health.cdi.GeronimoHealthExtension;
 import org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints;
 import org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints;
 import org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint;
@@ -26,30 +27,19 @@ import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreated;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.observer.event.BeforeEvent;
-import org.eclipse.microprofile.metrics.annotation.Counted;
-import org.eclipse.microprofile.metrics.annotation.Gauge;
-import org.eclipse.microprofile.metrics.annotation.Metered;
-import org.eclipse.microprofile.metrics.annotation.Metric;
-import org.eclipse.microprofile.metrics.annotation.Timed;
 
 import javax.annotation.Priority;
 import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
 import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
 import javax.enterprise.inject.spi.CDI;
 import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessInjectionPoint;
-import javax.enterprise.inject.spi.WithAnnotations;
+import java.util.Collection;
+import java.util.Optional;
 
-import static javax.interceptor.Interceptor.Priority.LIBRARY_BEFORE;
+import static javax.interceptor.Interceptor.Priority.PLATFORM_AFTER;
 
 public class TomEEMicroProfileExtension implements Extension {
-    private static final int BEFORE_MICROPROFILE_EXTENSIONS = LIBRARY_BEFORE - 10;
-
     private boolean requiresConfig;
     private boolean requiresJwt;
     private boolean requiresFaultTolerance;
@@ -59,52 +49,27 @@ public class TomEEMicroProfileExtension implements Extension {
     private boolean requiresOpenTracing;
     private boolean requiresRestClient;
 
-    void beforeBeanDiscovery(@Observes
-                             @Priority(BEFORE_MICROPROFILE_EXTENSIONS) final BeforeBeanDiscovery beforeBeanDiscovery) {
-        this.requiresConfig = true;
-        this.requiresJwt = true;
-        this.requiresFaultTolerance = true;
-        // MP Metrics is not required unless specific annotations are found (or additional REST enpoints are deployed)
-        this.requiresMetrics = false;
-        this.requiresHealth = true;
-        this.requiresOpenApi = true;
-        this.requiresOpenTracing = true;
-        this.requiresRestClient = true;
-    }
+    void afterDeploymentValidation(
+            @Observes
+            @Priority(PLATFORM_AFTER + 10)
+            final AfterDeploymentValidation afterDeploymentValidation,
+            final BeanManager beanManager) {
+        requiresConfig = true;
 
-    void processMPAnnotatedTypes(@Observes
-                                 @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
-                                 @WithAnnotations({
-                                         Metric.class,
-                                         Counted.class,
-                                         Gauge.class,
-                                         Metered.class,
-                                         Timed.class
-                                 }) final ProcessAnnotatedType<?> processAnnotatedType) {
-
-        final AnnotatedType<?> annotatedType = processAnnotatedType.getAnnotatedType();
-        if (annotatedType.getJavaClass().getName().startsWith("org.apache.geronimo.microprofile")) {
-            return;
-        }
+        requiresJwt = true;
 
-        hasMetricsAnnotations(annotatedType);
-    }
+        requiresFaultTolerance = true;
 
-    void processMPInjectionPoints(@Observes
-                                  @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
-                                  final ProcessInjectionPoint<?, ?> processInjectionPoint) {
-        hasMetricsAnnotations(processInjectionPoint.getInjectionPoint().getAnnotated());
-    }
+        requiresMetrics = false;
+
+        final GeronimoHealthExtension healthExtension = beanManager.getExtension(GeronimoHealthExtension.class);
+        requiresHealth = !Optional.ofNullable(healthExtension.getChecks()).map(Collection::isEmpty).orElse(true);
+
+        requiresOpenApi = false;
+
+        requiresOpenTracing = false;
 
-    void processMPBeans(@Observes
-                        @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
-                        final AfterBeanDiscovery afterBeanDiscovery,
-                        final BeanManager beanManager) {
-        /*
-        final List<Interceptor<?>> interceptors =
-                beanManager.resolveInterceptors(AROUND_INVOKE, new AnnotationLiteral<Counted>() {});
-        interceptors.isEmpty();
-        */
+        requiresRestClient = false;
     }
 
     public boolean requiresConfig() {
@@ -139,18 +104,6 @@ public class TomEEMicroProfileExtension implements Extension {
         return requiresRestClient;
     }
 
-    private void hasMetricsAnnotations(final Annotated annotated) {
-        if (requiresMetrics) {
-            return;
-        }
-
-        requiresMetrics = annotated.isAnnotationPresent(Metric.class) ||
-                          annotated.isAnnotationPresent(Counted.class) ||
-                          annotated.isAnnotationPresent(Gauge.class) ||
-                          annotated.isAnnotationPresent(Metered.class) ||
-                          annotated.isAnnotationPresent(Timed.class);
-    }
-
     static {
         SystemInstance.get().addObserver(new TomEEMicroProfileAfterApplicationCreated());
     }
@@ -164,14 +117,22 @@ public class TomEEMicroProfileExtension implements Extension {
                     CDI.current().getBeanManager().getExtension(TomEEMicroProfileExtension.class);
             final AppInfo app = afterApplicationCreated.getEvent().getApp();
             for (final WebAppInfo webApp : app.webApps) {
-                if (webApp.restApplications.isEmpty()) {
-                    webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
-                    webApp.restClass.removeIf(className -> className.equals(CdiHealthChecksEndpoint.class.getName()));
-
-                    webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
-                    webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
+                webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
+                webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
 
-                    webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
+                if (webApp.restApplications.isEmpty()) {
+                    if (!microProfileExtension.requiresHealth()) {
+                        webApp.restClass.removeIf(
+                                className -> className.equals(CdiHealthChecksEndpoint.class.getName()));
+                    }
+
+                    if (!microProfileExtension.requiresMetrics()) {
+                        webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
+                    }
+
+                    if (!microProfileExtension.requiresOpenApi()) {
+                        webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
+                    }
                 }
             }
         }


[tomee] 09/16: TOMEE-2408 - Exclude some libraries from scanning.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 173ffecb263e063dab0c34e9434606cccf4fb4db
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Tue Jan 22 22:56:30 2019 +0000

    TOMEE-2408 - Exclude some libraries from scanning.
---
 container/openejb-core/src/main/resources/default.exclusions | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/container/openejb-core/src/main/resources/default.exclusions b/container/openejb-core/src/main/resources/default.exclusions
index d795634..aaac83e 100644
--- a/container/openejb-core/src/main/resources/default.exclusions
+++ b/container/openejb-core/src/main/resources/default.exclusions
@@ -109,6 +109,7 @@ istack-commons-runtime-
 jackson-annotations-
 jackson-core-
 jackson-databind-
+jackson-dataformat
 jackson-mapper-asl-
 jackson-module-jaxb-annotations-
 janino-
@@ -138,6 +139,7 @@ jline
 jmdns-
 joda-time-
 johnzon-
+jose4j-
 jsoup-
 jsp-api
 jsr299-
@@ -156,6 +158,7 @@ lucene-core-
 management-agent.jar
 maven-
 mbean-annotation-api-
+microprofile-
 mimepull-
 mina-
 mqtt-client-
@@ -191,11 +194,13 @@ openejb-webservices
 openjpa-
 openmdx-
 opensaml-
+opentracing-
 openwebbeans-
 openws-
 ops4j-
 org.eclipse.
 org.junit.
+org.osgi.annotation.versioning-
 org.osgi.core-
 oro-
 pax-url
@@ -222,6 +227,7 @@ shrinkwrap-
 slf4j-
 smack-
 smackx-
+snakeyaml-
 snappy-java-
 spring-
 sshd-


[tomee] 02/16: TOMEE-2408 - Removed all MP deployable endpoints. Rules required to activate them.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 1a4e4adc5d6b0785409592f8ae79548cc1bded91
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Fri Jan 18 17:19:40 2019 +0000

    TOMEE-2408 - Removed all MP deployable endpoints. Rules required to activate them.
---
 .../cdi/TomEEMicroProfileExtension.java            | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
index c3e094c..2765395 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
@@ -16,8 +16,10 @@
  */
 package org.apache.tomee.microprofile.cdi;
 
-import org.apache.geronimo.microprofile.impl.health.jaxrs.HealthChecksEndpoint;
-import org.apache.geronimo.microprofile.metrics.jaxrs.MetricsEndpoints;
+import org.apache.geronimo.microprofile.common.jaxrs.HealthChecksEndpoint;
+import org.apache.geronimo.microprofile.impl.health.cdi.CdiHealthChecksEndpoint;
+import org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints;
+import org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints;
 import org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint;
 import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.assembler.classic.WebAppInfo;
@@ -39,15 +41,10 @@ import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;
 import javax.enterprise.inject.spi.CDI;
 import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.enterprise.inject.spi.ProcessInjectionPoint;
 import javax.enterprise.inject.spi.WithAnnotations;
-import javax.enterprise.util.AnnotationLiteral;
 
-import java.util.List;
-
-import static javax.enterprise.inject.spi.InterceptionType.AROUND_INVOKE;
 import static javax.interceptor.Interceptor.Priority.LIBRARY_BEFORE;
 
 public class TomEEMicroProfileExtension implements Extension {
@@ -103,9 +100,11 @@ public class TomEEMicroProfileExtension implements Extension {
                         @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
                         final AfterBeanDiscovery afterBeanDiscovery,
                         final BeanManager beanManager) {
+        /*
         final List<Interceptor<?>> interceptors =
                 beanManager.resolveInterceptors(AROUND_INVOKE, new AnnotationLiteral<Counted>() {});
         interceptors.isEmpty();
+        */
     }
 
     public boolean requiresConfig() {
@@ -156,7 +155,7 @@ public class TomEEMicroProfileExtension implements Extension {
         SystemInstance.get().addObserver(new TomEEMicroProfileAfterApplicationCreated());
     }
 
-    static class TomEEMicroProfileAfterApplicationCreated {
+    public static class TomEEMicroProfileAfterApplicationCreated {
         public void processApplication(
                 @org.apache.openejb.observer.Observes
                 final BeforeEvent<AssemblerAfterApplicationCreated> afterApplicationCreated) {
@@ -166,11 +165,12 @@ public class TomEEMicroProfileExtension implements Extension {
             final AppInfo app = afterApplicationCreated.getEvent().getApp();
             for (final WebAppInfo webApp : app.webApps) {
                 if (webApp.restApplications.isEmpty()) {
-                    if (!microProfileExtension.requiresMetrics) {
-                        webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
-                    }
-
                     webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
+                    webApp.restClass.removeIf(className -> className.equals(CdiHealthChecksEndpoint.class.getName()));
+
+                    webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
+                    webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
+
                     webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
                 }
             }


[tomee] 15/16: TOMEE-2462 - Added test to verify servlets, default servlet and rest endpoints execution.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 3f59d382b12ebc17b2d1fc9e587486d55fc4a749
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Thu Jan 31 18:35:02 2019 +0000

    TOMEE-2462 - Added test to verify servlets, default servlet and rest endpoints execution.
---
 .../arquillian/tests/jaxrs/servlets/Echo.java      | 28 +++++++++++++
 .../tests/jaxrs/servlets/RestWithServletsTest.java | 49 ++++++++++++++++++++++
 .../tests/jaxrs/servlets/RootServlet.java          | 33 +++++++++++++++
 .../arquillian/tests/jaxrs/servlets/Servlet.java   | 33 +++++++++++++++
 .../arquillian/tests/jaxrs/servlets/ok.html        |  1 +
 5 files changed, 144 insertions(+)

diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java
new file mode 100644
index 0000000..eba9000
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/echo")
+public class Echo {
+    @GET
+    public String ok() {
+        return "ok!";
+    }
+}
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java
new file mode 100644
index 0000000..8b4e214
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import org.apache.openejb.arquillian.tests.jaxrs.JaxrsTest;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class RestWithServletsTest extends JaxrsTest {
+    @Deployment(testable = false)
+    public static WebArchive archive() {
+        final WebArchive webArchive =
+                ShrinkWrap.create(WebArchive.class)
+                          .addClass(Echo.class)
+                          .addClass(Servlet.class)
+                          .addAsWebResource("org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html", "ok.html");
+        System.out.println(webArchive.toString(true));
+        return webArchive;
+    }
+
+    @Test
+    public void servlets() throws Exception {
+        assertTrue(get("/ok.html").contains("<html><body>ok!</body></html>"));
+        assertEquals("ok!", get("/servlet"));
+        assertEquals("ok!", get("/echo"));
+    }
+}
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java
new file mode 100644
index 0000000..62ebcfc
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebServlet(urlPatterns = "/")
+public class RootServlet extends HttpServlet {
+    @Override
+    protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
+            throws ServletException, IOException {
+        resp.getWriter().write("ok!");
+    }
+}
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java
new file mode 100644
index 0000000..6db6f78
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebServlet(urlPatterns = "/servlet")
+public class Servlet extends HttpServlet {
+    @Override
+    protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
+            throws ServletException, IOException {
+        resp.getWriter().write("ok!");
+    }
+}
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html
new file mode 100644
index 0000000..c7be294
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html
@@ -0,0 +1 @@
+<html><body>ok!</body></html>


[tomee] 06/16: TOMEE-2408 - Removed the MicroProfileExtension. Is not needed.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit fc9fa5d4ba13b051dd920c58d8c9802fab60254e
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 21 23:33:24 2019 +0000

    TOMEE-2408 - Removed the MicroProfileExtension. Is not needed.
---
 .../cdi/TomEEMicroProfileExtension.java            | 140 ---------------------
 .../services/javax.enterprise.inject.spi.Extension |  17 ---
 2 files changed, 157 deletions(-)

diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
deleted file mode 100644
index 3881cfb..0000000
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.microprofile.cdi;
-
-import org.apache.geronimo.microprofile.common.jaxrs.HealthChecksEndpoint;
-import org.apache.geronimo.microprofile.impl.health.cdi.CdiHealthChecksEndpoint;
-import org.apache.geronimo.microprofile.impl.health.cdi.GeronimoHealthExtension;
-import org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints;
-import org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints;
-import org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint;
-import org.apache.openejb.assembler.classic.AppInfo;
-import org.apache.openejb.assembler.classic.WebAppInfo;
-import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreated;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.observer.event.BeforeEvent;
-
-import javax.annotation.Priority;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.CDI;
-import javax.enterprise.inject.spi.Extension;
-import java.util.Collection;
-import java.util.Optional;
-
-import static javax.interceptor.Interceptor.Priority.PLATFORM_AFTER;
-
-public class TomEEMicroProfileExtension implements Extension {
-    private boolean requiresConfig;
-    private boolean requiresJwt;
-    private boolean requiresFaultTolerance;
-    private boolean requiresMetrics;
-    private boolean requiresHealth;
-    private boolean requiresOpenApi;
-    private boolean requiresOpenTracing;
-    private boolean requiresRestClient;
-
-    void afterDeploymentValidation(
-            @Observes
-            @Priority(PLATFORM_AFTER + 10)
-            final AfterDeploymentValidation afterDeploymentValidation,
-            final BeanManager beanManager) {
-        requiresConfig = true;
-
-        requiresJwt = true;
-
-        requiresFaultTolerance = true;
-
-        requiresMetrics = false;
-
-        final GeronimoHealthExtension healthExtension = beanManager.getExtension(GeronimoHealthExtension.class);
-        requiresHealth = !Optional.ofNullable(healthExtension.getChecks()).map(Collection::isEmpty).orElse(true);
-
-        requiresOpenApi = false;
-
-        requiresOpenTracing = false;
-
-        requiresRestClient = false;
-    }
-
-    public boolean requiresConfig() {
-        return requiresConfig;
-    }
-
-    public boolean requiresJwt() {
-        return requiresJwt;
-    }
-
-    public boolean requiresFaultTolerance() {
-        return requiresFaultTolerance;
-    }
-
-    public boolean requiresMetrics() {
-        return requiresMetrics;
-    }
-
-    public boolean requiresHealth() {
-        return requiresHealth;
-    }
-
-    public boolean requiresOpenApi() {
-        return requiresOpenApi;
-    }
-
-    public boolean requiresOpenTrakcing() {
-        return requiresOpenTracing;
-    }
-
-    public boolean requiresRestClient() {
-        return requiresRestClient;
-    }
-
-    static {
-        SystemInstance.get().addObserver(new TomEEMicroProfileAfterApplicationCreated());
-    }
-
-    public static class TomEEMicroProfileAfterApplicationCreated {
-        public void processApplication(
-                @org.apache.openejb.observer.Observes
-                final BeforeEvent<AssemblerAfterApplicationCreated> afterApplicationCreated) {
-
-            final TomEEMicroProfileExtension microProfileExtension =
-                    CDI.current().getBeanManager().getExtension(TomEEMicroProfileExtension.class);
-            final AppInfo app = afterApplicationCreated.getEvent().getApp();
-            for (final WebAppInfo webApp : app.webApps) {
-                webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
-                webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
-
-                if (webApp.restApplications.isEmpty()) {
-                    if (!microProfileExtension.requiresHealth()) {
-                        webApp.restClass.removeIf(
-                                className -> className.equals(CdiHealthChecksEndpoint.class.getName()));
-                    }
-
-                    if (!microProfileExtension.requiresMetrics()) {
-                        webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
-                    }
-
-                    if (!microProfileExtension.requiresOpenApi()) {
-                        webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
deleted file mode 100644
index 8caea11..0000000
--- a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-org.apache.tomee.microprofile.cdi.TomEEMicroProfileExtension


[tomee] 11/16: TOMEE-2408 - ApplicationComposer in Arquillian Remote with MP not supported yet.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit fb130458f39e078043c351887f469a8e67704d4a
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Wed Jan 23 15:50:13 2019 +0000

    TOMEE-2408 - ApplicationComposer in Arquillian Remote with MP not supported yet.
---
 .../apache/openejb/arquillian/tests/appcomposer/AppComposerTest.java    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerTest.java
index 31434ea..956164c 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerTest.java
@@ -23,6 +23,7 @@ import org.jboss.arquillian.test.api.ArquillianResource;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -31,6 +32,7 @@ import java.net.URL;
 
 import static org.junit.Assert.assertEquals;
 
+@Ignore
 @RunWith(Arquillian.class)
 public class AppComposerTest {
     @Deployment(testable = false)


[tomee] 04/16: TOMEE-2408 - Fixed CDI Scanning for MP in EAR deployments.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 76f91408a2ddd5d05ede0d3be93df4c3d5a96079
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 21 21:41:15 2019 +0000

    TOMEE-2408 - Fixed CDI Scanning for MP in EAR deployments.
---
 .../openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java   | 2 --
 1 file changed, 2 deletions(-)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
index e6947b0..b98987a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
@@ -133,8 +133,6 @@ public class CdiScanner implements BdaScannerService {
                 if (!ejbJar.moduleId.equals(startupObject.getWebContext().getId())) {
                     continue;
                 }
-            } else if (ejbJar.webapp && !appInfo.webAppAlone) {
-                continue;
             }
 
             if (appInfo.webAppAlone || !ejbJar.webapp) {


[tomee] 08/16: TOMEE-2408 - CDI scanning for additional libraries, skipping if to deploy only the related ejb module.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit de5a2ee7aafe08c4caf20c8ae322cabde5f1cbcf
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Tue Jan 22 18:50:46 2019 +0000

    TOMEE-2408 - CDI scanning for additional libraries, skipping if to deploy only the related ejb module.
---
 .../src/main/java/org/apache/openejb/cdi/CdiScanner.java     | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
index b98987a..7b9804b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
@@ -154,6 +154,13 @@ public class CdiScanner implements BdaScannerService {
 
             final Map<BeansInfo.BDAInfo, BeanArchiveService.BeanArchiveInformation> infoByBda = new HashMap<>();
             for (final BeansInfo.BDAInfo bda : beans.bdas) {
+                if (!startupObject.isFromWebApp() &&
+                    ejbJar.webapp &&
+                    !appInfo.webAppAlone &&
+                    bda.uri.toString().contains(ejbJar.path)) {
+                    continue;
+                }
+
                 if (bda.uri != null) {
                     try {
                         beansXml.add(bda.uri.toURL());
@@ -163,6 +170,11 @@ public class CdiScanner implements BdaScannerService {
                 }
                 infoByBda.put(bda, handleBda(startupObject, classLoader, comparator, beans, scl, filterByClassLoader, beanArchiveService, openejb, bda));
             }
+
+            if (!startupObject.isFromWebApp() && ejbJar.webapp && !appInfo.webAppAlone) {
+                continue;
+            }
+
             for (final BeansInfo.BDAInfo bda : beans.noDescriptorBdas) {
                 // infoByBda.put() not needed since we know it means annotated
                 handleBda(startupObject, classLoader, comparator, beans, scl, filterByClassLoader, beanArchiveService, openejb, bda);


[tomee] 05/16: TOMEE-2408 - Added MicroProfile to Plus and Plume.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 766a662dadc1ddcef609c7c78545cec79c6425bb
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 21 23:32:12 2019 +0000

    TOMEE-2408 - Added MicroProfile to Plus and Plume.
---
 tomee/tomee-plume-webapp/pom.xml | 128 ---------------------------------------
 tomee/tomee-plus-webapp/pom.xml  | 128 ---------------------------------------
 2 files changed, 256 deletions(-)

diff --git a/tomee/tomee-plume-webapp/pom.xml b/tomee/tomee-plume-webapp/pom.xml
index 3954191..d69405b 100644
--- a/tomee/tomee-plume-webapp/pom.xml
+++ b/tomee/tomee-plume-webapp/pom.xml
@@ -166,139 +166,11 @@
     -->
 
     <!-- MicroProfile -->
-    <!--
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>mp-common</artifactId>
       <version>${project.version}</version>
     </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.config</groupId>
-      <artifactId>microprofile-config-api</artifactId>
-      <version>${microprofile.config.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.config</groupId>
-      <artifactId>geronimo-config-impl</artifactId>
-      <version>${microprofile.config.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.jwt</groupId>
-      <artifactId>microprofile-jwt-auth-api</artifactId>
-      <version>${microprofile.jwt.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>mp-jwt</artifactId>
-      <version>${microprofile.jwt.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
-      <artifactId>microprofile-fault-tolerance-api</artifactId>
-      <version>${microprofile.fault-tolerance.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.safeguard</groupId>
-      <artifactId>safeguard-impl</artifactId>
-      <version>${microprofile.fault-tolerance.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.health</groupId>
-      <artifactId>microprofile-health-api</artifactId>
-      <version>${microprofile.health.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-health</artifactId>
-      <version>${microprofile.health.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.metrics</groupId>
-      <artifactId>microprofile-metrics-api</artifactId>
-      <version>${microprofile.metrics.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-metrics</artifactId>
-      <version>${microprofile.metrics.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.rest.client</groupId>
-      <artifactId>microprofile-rest-client-api</artifactId>
-      <version>${microprofile.rest-client.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-rs-mp-client</artifactId>
-      <version>${microprofile.rest-client.impl.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.json</groupId>
-          <artifactId>javax.json-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.openapi</groupId>
-      <artifactId>microprofile-openapi-api</artifactId>
-      <version>${microprofile.openapi.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-openapi-impl</artifactId>
-      <version>${microprofile.openapi.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.dataformat</groupId>
-      <artifactId>jackson-dataformat-yaml</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.opentracing</groupId>
-      <artifactId>microprofile-opentracing-api</artifactId>
-      <version>${microprofile.opentracing.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.geronimo.specs</groupId>
-          <artifactId>geronimo-atinject_1.0_spec</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-opentracing</artifactId>
-      <version>${microprofile.opentracing.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>io.opentracing</groupId>
-      <artifactId>opentracing-api</artifactId>
-      <version>${opentracing.api}</version>
-    </dependency>
-    -->
   </dependencies>
 
   <build>
diff --git a/tomee/tomee-plus-webapp/pom.xml b/tomee/tomee-plus-webapp/pom.xml
index b73db1a..8471101 100644
--- a/tomee/tomee-plus-webapp/pom.xml
+++ b/tomee/tomee-plus-webapp/pom.xml
@@ -165,139 +165,11 @@
     -->
 
     <!-- MicroProfile -->
-    <!--
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>mp-common</artifactId>
       <version>${project.version}</version>
     </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.config</groupId>
-      <artifactId>microprofile-config-api</artifactId>
-      <version>${microprofile.config.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.config</groupId>
-      <artifactId>geronimo-config-impl</artifactId>
-      <version>${microprofile.config.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.jwt</groupId>
-      <artifactId>microprofile-jwt-auth-api</artifactId>
-      <version>${microprofile.jwt.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>mp-jwt</artifactId>
-      <version>${microprofile.jwt.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
-      <artifactId>microprofile-fault-tolerance-api</artifactId>
-      <version>${microprofile.fault-tolerance.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.safeguard</groupId>
-      <artifactId>safeguard-impl</artifactId>
-      <version>${microprofile.fault-tolerance.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.health</groupId>
-      <artifactId>microprofile-health-api</artifactId>
-      <version>${microprofile.health.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-health</artifactId>
-      <version>${microprofile.health.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.metrics</groupId>
-      <artifactId>microprofile-metrics-api</artifactId>
-      <version>${microprofile.metrics.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-metrics</artifactId>
-      <version>${microprofile.metrics.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.rest.client</groupId>
-      <artifactId>microprofile-rest-client-api</artifactId>
-      <version>${microprofile.rest-client.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-rs-mp-client</artifactId>
-      <version>${microprofile.rest-client.impl.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.json</groupId>
-          <artifactId>javax.json-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.openapi</groupId>
-      <artifactId>microprofile-openapi-api</artifactId>
-      <version>${microprofile.openapi.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-openapi-impl</artifactId>
-      <version>${microprofile.openapi.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.dataformat</groupId>
-      <artifactId>jackson-dataformat-yaml</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.opentracing</groupId>
-      <artifactId>microprofile-opentracing-api</artifactId>
-      <version>${microprofile.opentracing.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.geronimo.specs</groupId>
-          <artifactId>geronimo-atinject_1.0_spec</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-opentracing</artifactId>
-      <version>${microprofile.opentracing.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>io.opentracing</groupId>
-      <artifactId>opentracing-api</artifactId>
-      <version>${opentracing.api}</version>
-    </dependency>
-    -->
   </dependencies>
 
   <build>


[tomee] 14/16: TOMEE-2408 - Fixed NPE.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 26d5b4e51c1aec9af27e484dc72b454fb097e607
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Thu Jan 24 17:02:41 2019 +0000

    TOMEE-2408 - Fixed NPE.
---
 .../openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
index 7b9804b..f081703 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiScanner.java
@@ -157,6 +157,7 @@ public class CdiScanner implements BdaScannerService {
                 if (!startupObject.isFromWebApp() &&
                     ejbJar.webapp &&
                     !appInfo.webAppAlone &&
+                    ejbJar.path != null &&
                     bda.uri.toString().contains(ejbJar.path)) {
                     continue;
                 }


[tomee] 07/16: TOMEE-2408 - MicroProfileListener to removed duplicated endpoints and prevent servlet mapping clash.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit ba02c9470fcd0440eff367538509b1ea735177fa
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 21 23:36:15 2019 +0000

    TOMEE-2408 - MicroProfileListener to removed duplicated endpoints and prevent servlet mapping clash.
---
 .../apache/tomee/catalina/TomcatWebAppBuilder.java |  5 +-
 .../catalina/event/AfterApplicationCreated.java    | 11 +++-
 tomee/tomee-microprofile/mp-common/pom.xml         |  7 +++
 .../microprofile/TomEEMicroProfileListener.java    | 58 ++++++++++++++++++++++
 .../META-INF/org.apache.openejb.extension          |  1 +
 5 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 0a79755..493cb90 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -1780,7 +1780,10 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener, Pare
                 for (final WebAppInfo webAppInfo : contextInfo.appInfo.webApps) {
                     final String wId = getId(webAppInfo.host, webAppInfo.contextRoot, contextInfo.version);
                     if (id.equals(wId)) {
-                        SystemInstance.get().fireEvent(new AfterApplicationCreated(contextInfo.appInfo, webAppInfo));
+                        SystemInstance.get().fireEvent(
+                                new AfterApplicationCreated(contextInfo.appInfo,
+                                                            webAppInfo,
+                                                            standardContext.getServletContext()));
                         break;
                     }
                 }
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/event/AfterApplicationCreated.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/event/AfterApplicationCreated.java
index ced0c15..2c06fe3 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/event/AfterApplicationCreated.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/event/AfterApplicationCreated.java
@@ -20,14 +20,20 @@ import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.observer.Event;
 
+import javax.servlet.ServletContext;
+
 @Event
 public class AfterApplicationCreated {
     private final AppInfo app;
     private final WebAppInfo web;
+    private final ServletContext context;
 
-    public AfterApplicationCreated(final AppInfo appInfo, final WebAppInfo webApp) {
+    public AfterApplicationCreated(final AppInfo appInfo,
+                                   final WebAppInfo webApp,
+                                   final ServletContext servletContext) {
         app = appInfo;
         web = webApp;
+        context = servletContext;
     }
 
     public AppInfo getApp() {
@@ -38,6 +44,9 @@ public class AfterApplicationCreated {
         return web;
     }
 
+    public ServletContext getContext() {
+        return context;
+    }
 
     @Override
     public String toString() {
diff --git a/tomee/tomee-microprofile/mp-common/pom.xml b/tomee/tomee-microprofile/mp-common/pom.xml
index da9f024..582741a 100644
--- a/tomee/tomee-microprofile/mp-common/pom.xml
+++ b/tomee/tomee-microprofile/mp-common/pom.xml
@@ -36,6 +36,13 @@
       <scope>provided</scope>
     </dependency>
 
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>tomee-catalina</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- MicroProfile -->
     <dependency>
       <groupId>org.eclipse.microprofile.config</groupId>
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
new file mode 100644
index 0000000..353ac8e
--- /dev/null
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.microprofile;
+
+import org.apache.geronimo.microprofile.common.jaxrs.HealthChecksEndpoint;
+import org.apache.geronimo.microprofile.impl.health.cdi.CdiHealthChecksEndpoint;
+import org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints;
+import org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints;
+import org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint;
+import org.apache.openejb.assembler.classic.WebAppInfo;
+import org.apache.openejb.observer.Observes;
+import org.apache.openejb.observer.event.BeforeEvent;
+import org.apache.tomee.catalina.event.AfterApplicationCreated;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRegistration;
+import java.util.Collection;
+
+public class TomEEMicroProfileListener {
+    public void processApplication(@Observes final BeforeEvent<AfterApplicationCreated> afterApplicationCreated) {
+        final ServletContext context = afterApplicationCreated.getEvent().getContext();
+        final WebAppInfo webApp = afterApplicationCreated.getEvent().getWeb();
+
+        // These remove duplicated REST API endpoints.
+        webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
+        webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
+
+        // There remove all of MP REST API endpoint if there is a servlet already registered in /*. The issue here is
+        // that REST path has priority over servlet and there may override old applications that have servlets
+        // with /* mapping.
+        context.getServletRegistrations()
+               .values()
+               .stream()
+               .map(ServletRegistration::getMappings)
+               .flatMap(Collection::stream)
+               .filter(mapping -> mapping.equals("/*"))
+               .findFirst()
+               .ifPresent(mapping -> {
+                   webApp.restClass.removeIf(className -> className.equals(CdiHealthChecksEndpoint.class.getName()));
+                   webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
+                   webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
+               });
+    }
+}
diff --git a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/org.apache.openejb.extension b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/org.apache.openejb.extension
new file mode 100644
index 0000000..3192713
--- /dev/null
+++ b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/org.apache.openejb.extension
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.TomEEMicroProfileListener


[tomee] 12/16: TOMEE-2408 - Workaround for OpenAPI issue (GERONIMO-6690).

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit ccc326f0e406571e78c734e04e09ece070358a6c
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Wed Jan 23 15:50:51 2019 +0000

    TOMEE-2408 - Workaround for OpenAPI issue (GERONIMO-6690).
---
 .../openejb/arquillian/tests/jaxrs/staticresources/TheResource.java     | 2 +-
 .../openejb/arquillian/tests/jaxrs/webxmloverride/TheResource.java      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/TheResource.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/TheResource.java
index 95051fd..1219bfa 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/TheResource.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/TheResource.java
@@ -21,7 +21,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Context;
 
-@Path("/")
+@Path("")
 public class TheResource {
     @GET
     @Path("the")
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/webxmloverride/TheResource.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/webxmloverride/TheResource.java
index c15814a..542dde5 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/webxmloverride/TheResource.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/webxmloverride/TheResource.java
@@ -19,7 +19,7 @@ package org.apache.openejb.arquillian.tests.jaxrs.webxmloverride;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 
-@Path("/")
+@Path("")
 public class TheResource {
     @GET
     @Path("touch")


[tomee] 13/16: TOMEE-2408 - Readded MP libraries. Apparently they are needed in some cases.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 8f0dacdf5df497c3e3239eb0a926a64226809ddd
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Wed Jan 23 17:14:34 2019 +0000

    TOMEE-2408 - Readded MP libraries. Apparently they are needed in some cases.
---
 container/openejb-core/src/main/resources/default.exclusions | 1 -
 1 file changed, 1 deletion(-)

diff --git a/container/openejb-core/src/main/resources/default.exclusions b/container/openejb-core/src/main/resources/default.exclusions
index aaac83e..624509b 100644
--- a/container/openejb-core/src/main/resources/default.exclusions
+++ b/container/openejb-core/src/main/resources/default.exclusions
@@ -158,7 +158,6 @@ lucene-core-
 management-agent.jar
 maven-
 mbean-annotation-api-
-microprofile-
 mimepull-
 mina-
 mqtt-client-


[tomee] 16/16: TOMEE-2408 - Fixed issue with ClassNotFound due to web.xml change to metadata-complete. Tomcat performs scanning on classes to find webapp annotations and this happened before adding the TomEE lib jars into the classloader.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 58674b8bbae159cc44b61645486240a01c405cf2
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Fri Feb 1 01:24:59 2019 +0000

    TOMEE-2408 - Fixed issue with ClassNotFound due to web.xml change to metadata-complete. Tomcat performs scanning on classes to find webapp annotations and this happened before adding the TomEE lib jars into the classloader.
---
 tomee/tomee-webapp/src/main/assembly/war.xml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tomee/tomee-webapp/src/main/assembly/war.xml b/tomee/tomee-webapp/src/main/assembly/war.xml
index 077b584..a00d820 100644
--- a/tomee/tomee-webapp/src/main/assembly/war.xml
+++ b/tomee/tomee-webapp/src/main/assembly/war.xml
@@ -95,6 +95,13 @@
         <include>org.codehaus.swizzle:swizzle-stream</include>
       </includes>
     </dependencySet>
+    <dependencySet>
+      <outputDirectory>WEB-INF/lib</outputDirectory>
+      <scope>compile</scope>
+      <includes>
+        <include>org.apache.tomee:tomee-common</include>
+      </includes>
+    </dependencySet>
   </dependencySets>
 </assembly>
 


[tomee] 10/16: TOMEE-2408 - Enable CDI for Tomcat TomEE webapp deployment.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 19d2f26d39fafbb86ffb7c1962bfabff211f6add
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Wed Jan 23 01:26:53 2019 +0000

    TOMEE-2408 - Enable CDI for Tomcat TomEE webapp deployment.
---
 .../src/main/java/org/apache/openejb/config/ConfigurationFactory.java | 4 ----
 tomee/tomee-webapp/src/main/webapp/WEB-INF/web.xml                    | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
index 6fd01d2..ab50cdd 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
@@ -567,10 +567,6 @@ public class ConfigurationFactory implements OpenEjbConfigurationFactory {
                 } else {
                     appInfo = configureApplication(new AppModule(SystemApps.getSystemModule()));
                 }
-                // they doesn't use CDI so no need to activate it
-                // 1) will be faster
-                // 2) will let embedded containers (tomee-embedded mainly) not be noised by it in our singleton service
-                appInfo.properties.put("openejb.cdi.activated", "false");
                 sys.containerSystem.applications.add(appInfo);
             } catch (final OpenEJBException e) {
                 logger.error("Unable to load the system applications.", e);
diff --git a/tomee/tomee-webapp/src/main/webapp/WEB-INF/web.xml b/tomee/tomee-webapp/src/main/webapp/WEB-INF/web.xml
index 8a01385..c8e3120 100644
--- a/tomee/tomee-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/tomee/tomee-webapp/src/main/webapp/WEB-INF/web.xml
@@ -19,7 +19,7 @@
 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
-         version="3.0" metadata-complete="true">
+         version="3.0">
 
   <display-name>Apache TomEE</display-name>
 


[tomee] 01/16: TOMEE-2408 - Initial work to make MicroProfile deployment only when required.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 8af6ae2bb4e1b1d362a21586c6bb648767eb2a5b
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Fri Dec 21 16:58:06 2018 +0000

    TOMEE-2408 - Initial work to make MicroProfile deployment only when required.
---
 .../apache/openejb/server/rest/RESTService.java    |   7 +-
 tomee/tomee-microprofile/mp-common/pom.xml         | 177 ++++++++++++++++----
 .../cdi/TomEEMicroProfileExtension.java            | 179 +++++++++++++++++++++
 .../services/javax.enterprise.inject.spi.Extension |  17 ++
 .../tomee-microprofile-webapp/pom.xml              | 131 +--------------
 5 files changed, 345 insertions(+), 166 deletions(-)

diff --git a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
index 9da7fd1..43d65b4 100644
--- a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
+++ b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
@@ -256,12 +256,7 @@ public abstract class RESTService implements ServerService, SelfManaging {
                     }
                 }
 
-                /*
-                boolean isMicroProfileOnlyEndpoints =
-                        webApp.restClass.stream().allMatch(name -> name.startsWith("org.apache.geronimo.microprofile"));
-                */
-
-                if (webApp.restApplications.isEmpty() /*&& !isMicroProfileOnlyEndpoints*/) {
+                if (webApp.restApplications.isEmpty()) {
                     final Application application = new InternalApplication(null);
                     for (final String clazz : webApp.restClass) {
                         try {
diff --git a/tomee/tomee-microprofile/mp-common/pom.xml b/tomee/tomee-microprofile/mp-common/pom.xml
index 263af46..da9f024 100644
--- a/tomee/tomee-microprofile/mp-common/pom.xml
+++ b/tomee/tomee-microprofile/mp-common/pom.xml
@@ -19,34 +19,149 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>tomee-microprofile</artifactId>
-        <groupId>org.apache.tomee</groupId>
-        <version>8.0.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>mp-common</artifactId>
-    <name>OpenEJB :: TomEE :: MicroProfile Common</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>javaee-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
-            <artifactId>microprofile-fault-tolerance-api</artifactId>
-            <version>${microprofile.fault-tolerance.version}</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.safeguard</groupId>
-            <artifactId>safeguard-impl</artifactId>
-            <version>${microprofile.fault-tolerance.impl.version}</version>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
+  <parent>
+    <artifactId>tomee-microprofile</artifactId>
+    <groupId>org.apache.tomee</groupId>
+    <version>8.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>mp-common</artifactId>
+  <name>OpenEJB :: TomEE :: MicroProfile Common</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>javaee-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- MicroProfile -->
+    <dependency>
+      <groupId>org.eclipse.microprofile.config</groupId>
+      <artifactId>microprofile-config-api</artifactId>
+      <version>${microprofile.config.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.config</groupId>
+      <artifactId>geronimo-config-impl</artifactId>
+      <version>${microprofile.config.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.jwt</groupId>
+      <artifactId>microprofile-jwt-auth-api</artifactId>
+      <version>${microprofile.jwt.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mp-jwt</artifactId>
+      <version>${microprofile.jwt.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
+      <artifactId>microprofile-fault-tolerance-api</artifactId>
+      <version>${microprofile.fault-tolerance.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.safeguard</groupId>
+      <artifactId>safeguard-impl</artifactId>
+      <version>${microprofile.fault-tolerance.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.health</groupId>
+      <artifactId>microprofile-health-api</artifactId>
+      <version>${microprofile.health.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-health</artifactId>
+      <version>${microprofile.health.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.metrics</groupId>
+      <artifactId>microprofile-metrics-api</artifactId>
+      <version>${microprofile.metrics.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-metrics</artifactId>
+      <version>${microprofile.metrics.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.rest.client</groupId>
+      <artifactId>microprofile-rest-client-api</artifactId>
+      <version>${microprofile.rest-client.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-rs-mp-client</artifactId>
+      <version>${microprofile.rest-client.impl.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.json</groupId>
+          <artifactId>javax.json-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.openapi</groupId>
+      <artifactId>microprofile-openapi-api</artifactId>
+      <version>${microprofile.openapi.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-openapi-impl</artifactId>
+      <version>${microprofile.openapi.impl.version}</version>
+    </dependency>
+
+    <!-- Jackson required by OpenAPI Impl -->
+    <dependency>
+      <groupId>com.fasterxml.jackson.dataformat</groupId>
+      <artifactId>jackson-dataformat-yaml</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.microprofile.opentracing</groupId>
+      <artifactId>microprofile-opentracing-api</artifactId>
+      <version>${microprofile.opentracing.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-atinject_1.0_spec</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-opentracing</artifactId>
+      <version>${microprofile.opentracing.impl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>io.opentracing</groupId>
+      <artifactId>opentracing-api</artifactId>
+      <version>${opentracing.api}</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
new file mode 100644
index 0000000..c3e094c
--- /dev/null
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/cdi/TomEEMicroProfileExtension.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.microprofile.cdi;
+
+import org.apache.geronimo.microprofile.impl.health.jaxrs.HealthChecksEndpoint;
+import org.apache.geronimo.microprofile.metrics.jaxrs.MetricsEndpoints;
+import org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint;
+import org.apache.openejb.assembler.classic.AppInfo;
+import org.apache.openejb.assembler.classic.WebAppInfo;
+import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreated;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.observer.event.BeforeEvent;
+import org.eclipse.microprofile.metrics.annotation.Counted;
+import org.eclipse.microprofile.metrics.annotation.Gauge;
+import org.eclipse.microprofile.metrics.annotation.Metered;
+import org.eclipse.microprofile.metrics.annotation.Metric;
+import org.eclipse.microprofile.metrics.annotation.Timed;
+
+import javax.annotation.Priority;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.CDI;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessInjectionPoint;
+import javax.enterprise.inject.spi.WithAnnotations;
+import javax.enterprise.util.AnnotationLiteral;
+
+import java.util.List;
+
+import static javax.enterprise.inject.spi.InterceptionType.AROUND_INVOKE;
+import static javax.interceptor.Interceptor.Priority.LIBRARY_BEFORE;
+
+public class TomEEMicroProfileExtension implements Extension {
+    private static final int BEFORE_MICROPROFILE_EXTENSIONS = LIBRARY_BEFORE - 10;
+
+    private boolean requiresConfig;
+    private boolean requiresJwt;
+    private boolean requiresFaultTolerance;
+    private boolean requiresMetrics;
+    private boolean requiresHealth;
+    private boolean requiresOpenApi;
+    private boolean requiresOpenTracing;
+    private boolean requiresRestClient;
+
+    void beforeBeanDiscovery(@Observes
+                             @Priority(BEFORE_MICROPROFILE_EXTENSIONS) final BeforeBeanDiscovery beforeBeanDiscovery) {
+        this.requiresConfig = true;
+        this.requiresJwt = true;
+        this.requiresFaultTolerance = true;
+        // MP Metrics is not required unless specific annotations are found (or additional REST enpoints are deployed)
+        this.requiresMetrics = false;
+        this.requiresHealth = true;
+        this.requiresOpenApi = true;
+        this.requiresOpenTracing = true;
+        this.requiresRestClient = true;
+    }
+
+    void processMPAnnotatedTypes(@Observes
+                                 @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
+                                 @WithAnnotations({
+                                         Metric.class,
+                                         Counted.class,
+                                         Gauge.class,
+                                         Metered.class,
+                                         Timed.class
+                                 }) final ProcessAnnotatedType<?> processAnnotatedType) {
+
+        final AnnotatedType<?> annotatedType = processAnnotatedType.getAnnotatedType();
+        if (annotatedType.getJavaClass().getName().startsWith("org.apache.geronimo.microprofile")) {
+            return;
+        }
+
+        hasMetricsAnnotations(annotatedType);
+    }
+
+    void processMPInjectionPoints(@Observes
+                                  @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
+                                  final ProcessInjectionPoint<?, ?> processInjectionPoint) {
+        hasMetricsAnnotations(processInjectionPoint.getInjectionPoint().getAnnotated());
+    }
+
+    void processMPBeans(@Observes
+                        @Priority(BEFORE_MICROPROFILE_EXTENSIONS)
+                        final AfterBeanDiscovery afterBeanDiscovery,
+                        final BeanManager beanManager) {
+        final List<Interceptor<?>> interceptors =
+                beanManager.resolveInterceptors(AROUND_INVOKE, new AnnotationLiteral<Counted>() {});
+        interceptors.isEmpty();
+    }
+
+    public boolean requiresConfig() {
+        return requiresConfig;
+    }
+
+    public boolean requiresJwt() {
+        return requiresJwt;
+    }
+
+    public boolean requiresFaultTolerance() {
+        return requiresFaultTolerance;
+    }
+
+    public boolean requiresMetrics() {
+        return requiresMetrics;
+    }
+
+    public boolean requiresHealth() {
+        return requiresHealth;
+    }
+
+    public boolean requiresOpenApi() {
+        return requiresOpenApi;
+    }
+
+    public boolean requiresOpenTrakcing() {
+        return requiresOpenTracing;
+    }
+
+    public boolean requiresRestClient() {
+        return requiresRestClient;
+    }
+
+    private void hasMetricsAnnotations(final Annotated annotated) {
+        if (requiresMetrics) {
+            return;
+        }
+
+        requiresMetrics = annotated.isAnnotationPresent(Metric.class) ||
+                          annotated.isAnnotationPresent(Counted.class) ||
+                          annotated.isAnnotationPresent(Gauge.class) ||
+                          annotated.isAnnotationPresent(Metered.class) ||
+                          annotated.isAnnotationPresent(Timed.class);
+    }
+
+    static {
+        SystemInstance.get().addObserver(new TomEEMicroProfileAfterApplicationCreated());
+    }
+
+    static class TomEEMicroProfileAfterApplicationCreated {
+        public void processApplication(
+                @org.apache.openejb.observer.Observes
+                final BeforeEvent<AssemblerAfterApplicationCreated> afterApplicationCreated) {
+
+            final TomEEMicroProfileExtension microProfileExtension =
+                    CDI.current().getBeanManager().getExtension(TomEEMicroProfileExtension.class);
+            final AppInfo app = afterApplicationCreated.getEvent().getApp();
+            for (final WebAppInfo webApp : app.webApps) {
+                if (webApp.restApplications.isEmpty()) {
+                    if (!microProfileExtension.requiresMetrics) {
+                        webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
+                    }
+
+                    webApp.restClass.removeIf(className -> className.equals(HealthChecksEndpoint.class.getName()));
+                    webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
+                }
+            }
+        }
+    }
+}
diff --git a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..8caea11
--- /dev/null
+++ b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.tomee.microprofile.cdi.TomEEMicroProfileExtension
diff --git a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
index 7beb65d..a5495cc 100644
--- a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
+++ b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
@@ -37,14 +37,8 @@
   <properties>
     <tomee.build.name>${project.groupId}.tomee.microprofile.webapp</tomee.build.name>
   </properties>
-  <dependencies>
-
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>mp-common</artifactId>
-      <version>${project.version}</version>
-    </dependency>
 
+  <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>tomee-webapp</artifactId>
@@ -53,131 +47,10 @@
     </dependency>
 
     <dependency>
-      <groupId>org.eclipse.microprofile.config</groupId>
-      <artifactId>microprofile-config-api</artifactId>
-      <version>${microprofile.config.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.config</groupId>
-      <artifactId>geronimo-config-impl</artifactId>
-      <version>${microprofile.config.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.jwt</groupId>
-      <artifactId>microprofile-jwt-auth-api</artifactId>
-      <version>${microprofile.jwt.version}</version>
-    </dependency>
-
-    <dependency>
       <groupId>${project.groupId}</groupId>
-      <artifactId>mp-jwt</artifactId>
+      <artifactId>mp-common</artifactId>
       <version>${project.version}</version>
     </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
-      <artifactId>microprofile-fault-tolerance-api</artifactId>
-      <version>${microprofile.fault-tolerance.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo.safeguard</groupId>
-      <artifactId>safeguard-impl</artifactId>
-      <version>${microprofile.fault-tolerance.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.health</groupId>
-      <artifactId>microprofile-health-api</artifactId>
-      <version>${microprofile.health.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-health</artifactId>
-      <version>${microprofile.health.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.metrics</groupId>
-      <artifactId>microprofile-metrics-api</artifactId>
-      <version>${microprofile.metrics.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-metrics</artifactId>
-      <version>${microprofile.metrics.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.rest.client</groupId>
-      <artifactId>microprofile-rest-client-api</artifactId>
-      <version>${microprofile.rest-client.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-rs-mp-client</artifactId>
-      <version>${microprofile.rest-client.impl.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.json</groupId>
-          <artifactId>javax.json-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.openapi</groupId>
-      <artifactId>microprofile-openapi-api</artifactId>
-      <version>${microprofile.openapi.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-openapi-impl</artifactId>
-      <version>${microprofile.openapi.impl.version}</version>
-    </dependency>
-
-    <!-- Jackson required by OpenAPI Impl -->
-    <dependency>
-      <groupId>com.fasterxml.jackson.dataformat</groupId>
-      <artifactId>jackson-dataformat-yaml</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.microprofile.opentracing</groupId>
-      <artifactId>microprofile-opentracing-api</artifactId>
-      <version>${microprofile.opentracing.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.geronimo.specs</groupId>
-          <artifactId>geronimo-atinject_1.0_spec</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.geronimo</groupId>
-      <artifactId>geronimo-opentracing</artifactId>
-      <version>${microprofile.opentracing.impl.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>io.opentracing</groupId>
-      <artifactId>opentracing-api</artifactId>
-      <version>${opentracing.api}</version>
-    </dependency>
   </dependencies>
 
   <build>