tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: trying to have the original exception in the stack using TomcatWebappDeployer
Date Sat, 14 Mar 2015 19:56:32 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 9b0b8ddf0 -> 668fff8be


trying to have the original exception in the stack using TomcatWebappDeployer


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

Branch: refs/heads/master
Commit: 668fff8be066bbf8f42c98730509a07d2d6942d0
Parents: 9b0b8dd
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Sat Mar 14 20:56:16 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Sat Mar 14 20:56:16 2015 +0100

----------------------------------------------------------------------
 tck/cdi-tomee/src/test/resources/failing.xml        |  2 +-
 .../apache/tomee/catalina/TomcatWebAppBuilder.java  |  2 +-
 .../catalina/deployment/TomcatWebappDeployer.java   | 16 ++++++++++++++--
 3 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/668fff8b/tck/cdi-tomee/src/test/resources/failing.xml
----------------------------------------------------------------------
diff --git a/tck/cdi-tomee/src/test/resources/failing.xml b/tck/cdi-tomee/src/test/resources/failing.xml
index 9fc2ecc..de07cc4 100644
--- a/tck/cdi-tomee/src/test/resources/failing.xml
+++ b/tck/cdi-tomee/src/test/resources/failing.xml
@@ -23,7 +23,7 @@
   -->
   <test name="CDI TCK">
     <classes>
-      <class name="org.jboss.cdi.tck.tests.context.application.async.ApplicationContextAsyncListenerTest"
/>
+      <class name="org.jboss.cdi.tck.tests.alternative.broken.incorrect.name.stereotype.NoAnnotationWithSpecifiedNameTest"
/>
     </classes>
   </test>
 </suite>

http://git-wip-us.apache.org/repos/asf/tomee/blob/668fff8b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
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 82beba6..a5dd170 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
@@ -466,7 +466,7 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
             {
                 final ClassLoader containerLoader = Helper.get();
                 final Host host = hosts.getDefault();
-                if (StandardHost.class.isInstance(host)) {
+                if (StandardHost.class.isInstance(host) && !StandardContext.class.getName().equals(StandardHost.class.cast(host).getContextClass()))
{
                     try {
                         standardContext = StandardContext.class.cast(containerLoader.loadClass(StandardHost.class.cast(host).getContextClass()).newInstance());
                     } catch (final Throwable th) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/668fff8b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
index 0d960fd..a09d8da 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
@@ -19,11 +19,13 @@ package org.apache.tomee.catalina.deployment;
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.assembler.WebAppDeployer;
 import org.apache.openejb.assembler.classic.AppInfo;
+import org.apache.openejb.assembler.classic.DeploymentExceptionManager;
 import org.apache.openejb.assembler.classic.WebAppBuilder;
 import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
+import org.apache.tomee.catalina.TomEERuntimeException;
 import org.apache.tomee.catalina.TomcatWebAppBuilder;
 
 import java.io.File;
@@ -39,9 +41,19 @@ public class TomcatWebappDeployer implements WebAppDeployer {
 
         final Collection<String> alreadyDeployed = tomcatWebAppBuilder.availableApps();
 
+        final AppInfo appInfo = fakeInfo(file, host, context);
         try {
-            tomcatWebAppBuilder.deployWebApps(fakeInfo(file, host, context), null); // classloader
== null -> standalone war
-        } catch (final Exception e) {
+            tomcatWebAppBuilder.deployWebApps(appInfo, null); // classloader == null ->
standalone war
+        } catch (final Exception e) { // tomcat lost the real exception (only in lifecycle
exception string) so try to find it back
+            final DeploymentExceptionManager dem = SystemInstance.get().getComponent(DeploymentExceptionManager.class);
+            if (dem != null && dem.hasDeploymentFailed()) {
+                Throwable lastException = dem.getLastException();
+                dem.clearLastException(appInfo); // TODO: fix it, since we dont use this
appInfo clean is ignored. Not a big deal while dem stores few exceptions only.
+                if (TomEERuntimeException.class.isInstance(lastException)) {
+                    lastException = TomEERuntimeException.class.cast(lastException).getCause();
+                }
+                throw new OpenEJBRuntimeException(Exception.class.cast(lastException));
+            }
             throw new OpenEJBRuntimeException(e);
         }
 


Mime
View raw message