diff --git a/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/loadable/JavaSPIExtensionLoader.java b/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/loadable/JavaSPIExtensionLoader.java index f44dabf1c..7942a2e26 100644 --- a/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/loadable/JavaSPIExtensionLoader.java +++ b/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/loadable/JavaSPIExtensionLoader.java @@ -21,6 +21,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; +import java.net.URLConnection; import java.util.Collection; import java.util.Enumeration; import java.util.LinkedHashMap; @@ -166,7 +167,10 @@ private Set> load(Class serviceClass, ClassLoader load Enumeration enumeration = loader.getResources(serviceFile); while (enumeration.hasMoreElements()) { final URL url = enumeration.nextElement(); - final InputStream is = url.openStream(); + URLConnection jarConnection = url.openConnection(); + //Don't cache the file (avoids file leaks on GlassFish). + jarConnection.setUseCaches(false); + final InputStream is = jarConnection.getInputStream(); BufferedReader reader = null; try {