Uploaded image for project: 'JBoss VFS'
  1. JBoss VFS
  2. JBVFS-109

Trying to access all classpath resources from a web application fails due to VFS errors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.1.2.GA
    • 2.1.1.GA
    • None
    • None

      The error has been triggered by using classpath scanning in Spring, but can be reproduced independently.

      The code in the servlet listed below does virtually the same thing as the VFSResourcePatternResolver:

      public class BasicServlet extends HttpServlet{

      @Override
      protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      Enumeration<URL> urls = classLoader.getResources("");
      StringBuffer buffer = new StringBuffer();
      while (urls.hasMoreElements())

      { URL url = urls.nextElement(); VirtualFile file = VFS.getRoot(url); buffer.append(file.getPathName() + "\n"); }

      new PrintWriter(resp.getOutputStream()).println(buffer.toString());
      }
      }

      Trying to access the servlet results in an error when one URL is converted to a VirtualFile by VFS.getRoot(), and here is the resulting exception. The URL that triggers the error differs if the test is repeated.

      00:45:44,380 ERROR [[resource-servlet]] Servlet.service() for servlet resource-servlet threw exception
      java.io.IOException: Child not found opt/jboss/jboss-5.0.1.GA/server/default/deployers/jbossws.deployer/policy.jar/ for MemoryContextHandler@555514482[path= context=vfsmemory://3j011-j4xs2m-fuc3y7a8-1-fuc3yl41-9 real=vfsmemory://3j011-j4xs2m-fuc3y7a8-1-fuc3yl41-9], available children: []
      at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.findHandler(DefaultVFSRegistry.java:109)
      at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.getFile(DefaultVFSRegistry.java:88)
      at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.getFile(DefaultVFSRegistry.java:121)
      at org.jboss.virtual.VFS.getRoot(VFS.java:276)
      at BasicServlet.doGet(BasicServlet.java:22)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)

              ajustin@redhat.com Ales Justin
              marius.bogoevici Marius Bogoevici (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: