[jboss-dev-forums] [Design of POJO Server] - Re: Scoping of war/jar file embedded in sar service archives

alesj do-not-reply at jboss.com
Sat Jul 19 17:14:52 EDT 2008


I've added a fix for this issue - a recursion in case parent classpath is not yet set:

  |    protected static Set<VirtualFile> determineClassPath(DeploymentUnit unit, Module module)
  |    {
  |       ClassPathVisitor visitor = new ClassPathVisitor(unit);
  |       try
  |       {
  |          unit.visit(visitor);
  |       }
  |       catch (DeploymentException e)
  |       {
  |          throw new RuntimeException("Error visiting deployment: " + e);
  |       }
  |       Set<VirtualFile> classPath = visitor.getClassPath();
  |       // Weed out parent classpaths
  |       if (module != null && module.getParentDomainName() == null)
  |       {
  |          DeploymentUnit parent = unit.getParent();
  |          while (parent != null)
  |          {
  |             Set<VirtualFile> parentClassPath = parent.getAttachment(VFS_CLASS_PATH, Set.class);
  |             if (parentClassPath == null)
  |                parentClassPath = determineClassPath(parent, parent.getAttachment(Module.class));
  | 
  |             if (parentClassPath != null && parentClassPath.isEmpty() == false)
  |             {
  |                if (log.isTraceEnabled())
  |                {
  |                   for (VirtualFile parentFile : parentClassPath)
  |                   {
  |                      if (classPath.contains(parentFile))
  |                         log.trace(unit + " weeding duplicate entry " + parentFile + " from classpath already in parent " + parent);
  |                   }
  |                }
  |                classPath.removeAll(parentClassPath);
  |             }
  |             parent = parent.getParent();
  |          }
  |       }
  |       unit.addAttachment(VFS_CLASS_PATH, classPath);
  |       return classPath;
  |    }
  | 
But I'll let you close the JIRA issue if you feel this is a proper fix. 

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

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



More information about the jboss-dev-forums mailing list