Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2015-01-06 16:30:43 +0000
committerSimone Bordet2015-01-06 16:30:43 +0000
commit379f9f6c432a0a1b2e0b93d93b98197489752ddd (patch)
tree397df6579685a38a1114ec1e0de272df221da9d0 /jetty-annotations
parent200b3a3e6440cf45506b0c206aa395baaadc9df6 (diff)
parent3abfbe26b391a7486fd3eb68586dad981bf77de8 (diff)
downloadorg.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.tar.gz
org.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.tar.xz
org.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.zip
Merged branch 'jetty-9.2.x' into 'master'.
Diffstat (limited to 'jetty-annotations')
-rw-r--r--jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
index c0a742d2e1..b018deb25f 100644
--- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
+++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.annotations;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -726,7 +727,15 @@ public class AnnotationConfiguration extends AbstractConfiguration
public Resource getJarFor (ServletContainerInitializer service)
throws MalformedURLException, IOException
{
- String loadingJarName = Thread.currentThread().getContextClassLoader().getResource(service.getClass().getName().replace('.','/')+".class").toString();
+ //try the thread context classloader to get the jar that loaded the class
+ URL jarURL = Thread.currentThread().getContextClassLoader().getResource(service.getClass().getName().replace('.','/')+".class");
+
+ //if for some reason that failed (eg we're in osgi and the TCCL does not know about the service) try the classloader that
+ //loaded the class
+ if (jarURL == null)
+ jarURL = service.getClass().getClassLoader().getResource(service.getClass().getName().replace('.','/')+".class");
+
+ String loadingJarName = jarURL.toString();
int i = loadingJarName.indexOf(".jar");
if (i < 0)
@@ -830,7 +839,6 @@ public class AnnotationConfiguration extends AbstractConfiguration
{
ArrayList<ServletContainerInitializer> nonExcludedInitializers = new ArrayList<ServletContainerInitializer>();
-
//We use the ServiceLoader mechanism to find the ServletContainerInitializer classes to inspect
long start = 0;

Back to the top