title: Google reflections on Websphere - Could not open url connection
body: <p>I'm having a project in which I'm using google Reflections and deploying the project on websphere liberty profile.</p>
  
  <p>My project has the following code, the Transformer.class is location in a dependency jar</p>
  
  <pre><code>private void bindTransformers(SimpleRegistry initialContext) throws Exception {
      Reflections reflections = new Reflections("no.mypackage.ntrouter");
      final Set&lt;Class&lt;?&gt;&gt; transformerClasses = reflections.getTypesAnnotatedWith(Transformer.class);
      for (Class&lt;?&gt; aClass : transformerClasses) {
          initialContext.put(aClass.getSimpleName(), aClass.newInstance());
      }
  }
  </code></pre>
  
  <p>But the reflections does not work, getting the following error:</p>
  
  <pre><code>2015-04-23 09:34:29,817 [ecutor-thread-5] WARN  Reflections                    - could not create Vfs.Dir from url. ignoring the exception and continuing
  org.reflections.ReflectionsException: Could not open url connection
      at org.reflections.vfs.JarInputDir$1$1.&lt;init&gt;(JarInputDir.java:36)
      at org.reflections.vfs.JarInputDir$1.iterator(JarInputDir.java:32)
      at org.reflections.Reflections.scan(Reflections.java:231)
      at org.reflections.Reflections.scan(Reflections.java:204)
      at org.reflections.Reflections.&lt;init&gt;(Reflections.java:129)
      at org.reflections.Reflections.&lt;init&gt;(Reflections.java:170)
      at org.reflections.Reflections.&lt;init&gt;(Reflections.java:143)
      at no.norsktipping.ntrouter.chain.MyServletContextListener.bindTransformers(MyServletContextListener.java:56)
      at no.norsktipping.ntrouter.chain.MyServletContextListener.contextInitialized(MyServletContextListener.java:29)
      at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2388)
      at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1048)
      at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6404)
      at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
      at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
      at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
      at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:241)
      at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:449)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:383)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:283)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:254)
      at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
      at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: java.io.FileNotFoundException: JAR entry  not found in &lt;address&gt;/usr/servers/chainrouter/workarea/org.eclipse.osgi/56/data/cache/com.ibm.ws.app.manager_7/.cache/WEB-INF/lib/RouterUtils-1.0-SNAPSHOT.jar
      at com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl.getInputStreamInternal(WSJarURLStreamHandler.java:283)
      at com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl.getInputStream(WSJarURLStreamHandler.java:264)
      at org.reflections.vfs.JarInputDir$1$1.&lt;init&gt;(JarInputDir.java:35)
      ... 29 more
  2015-04-23 09:34:29,826 [ecutor-thread-5] WARN  Reflections                    - could not create Vfs.Dir from url. ignoring the exception and continuing
  org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [wsjar:file:&lt;address2&gt;/ChainRouter/target/ChainRouter-1.0-SNAPSHOT.war!/WEB-INF/classes/]
  either use fromURL(final URL url, final List&lt;UrlType&gt; urlTypes) or use the static setDefaultURLTypes(final List&lt;UrlType&gt; urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
      at org.reflections.vfs.Vfs.fromURL(Vfs.java:109)
      at org.reflections.vfs.Vfs.fromURL(Vfs.java:91)
      at org.reflections.Reflections.scan(Reflections.java:231)
      at org.reflections.Reflections.scan(Reflections.java:204)
  </code></pre>