[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Moving out of the UnifiedClassloaders

alesj do-not-reply at jboss.com
Thu Jan 10 18:01:04 EST 2008


The Seam deployments are now failing.
I'm getting different URLs that I used to get.
And the resources from .war files - that are extracted to tmp/deploy - are duplicated.

This is Scanner code from Seam.

  |     protected void scan() 
  |     {
  |       Set<String> paths = new HashSet<String>();
  |       if (resourceName==null)
  |       {
  |          if (log.isTraceEnabled())
  |             log.trace("Scanning URLs from classloader: " + classLoader);
  | 
  |          for ( URL url: getURLsFromClassLoader() )
  |          {
  |             String urlPath = url.getFile();
  |             if ( urlPath.endsWith("/") )
  |             {
  |                urlPath = urlPath.substring( 0, urlPath.length()-1 );
  |             }
  |             paths.add( urlPath );
  |          }
  |       }
  |       else
  |       {
  |          if (log.isTraceEnabled())
  |             log.trace("Scanning URLs from resource: " + resourceName);
  | 
  |          try
  |          {
  |             Enumeration<URL> urlEnum = classLoader.getResources(resourceName);
  |             while ( urlEnum.hasMoreElements() )
  |             {
  |                String urlPath = urlEnum.nextElement().getFile();
  |                urlPath = URLDecoder.decode(urlPath, "UTF-8");
  |                if ( urlPath.startsWith("file:") )
  |                {
  |                   if (useVFS())
  |                      urlPath = "vfs" + urlPath;
  |                   else
  |                      urlPath = urlPath.substring(5);
  |                }
  |                if ( urlPath.indexOf('!')>0 )
  |                {
  |                   urlPath = urlPath.substring(0, urlPath.indexOf('!'));
  |                }
  |                else
  |                {
  |                   File dirOrArchive = new File(urlPath);
  |                   if ( resourceName!=null && resourceName.lastIndexOf('/')>0 )
  |                   {
  |                      //for META-INF/components.xml
  |                      dirOrArchive = dirOrArchive.getParentFile();
  |                   }
  |                   urlPath = dirOrArchive.getParent();
  |                }
  |                paths.add(urlPath);
  |             }
  |          }
  |          catch (IOException ioe) 
  |          {
  |             log.warn("could not read: " + resourceName, ioe);
  |             return;
  |          }
  |       }
  |       
  |       for ( String urlPath: paths )
  |       {
  |          try
  |          {
  |             log.info("scanning: " + urlPath);
  |             File file = new File(urlPath);
  |             if ( file.isDirectory() )
  |             {
  |                handleDirectory(file, null);
  |             }
  |             else if (useVFS())
  |             {
  |                URL url = new URL(urlPath);
  |                handleArchiveByURL(url);
  |             }
  |             else
  |             {
  |                handleArchiveByFile(file);
  |             }
  |          }
  |          catch (IOException ioe) 
  |          {
  |             log.warn("could not read entries", ioe);
  |          }
  |       }
  |    }
  | 

I added the useVSF part, which knew how to handle our vfs URLs.
Now I'm getting direct path:
e.g. 23:16:17,890 INFO  [Scanner] scanning: C:\projects\jboss5\trunk\build\output\jboss-5.0.0.Beta4\server\default\deploy\jboss-seam-booking.ear\jboss-seam.jar

The duplicated part:
23:16:17,609 INFO [Scanner] scanning: vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.Beta4/server/default/tmp/deploy/jboss-seam-booking2549-exp.war/WEB-INF/lib/jboss-seam-ui.jar
23:16:17,640 INFO [Scanner] scanning: C:\projects\jboss5\trunk\build\output\jboss-5.0.0.Beta4\server\default\deploy\jboss-seam-booking.ear\jboss-seam-booking.war\WEB-INF\lib\jboss-seam-ui.jar 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118870#4118870

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118870



More information about the jboss-dev-forums mailing list