[jboss-cvs] JBossAS SVN: r68329 - trunk/server/src/main/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Dec 16 19:11:45 EST 2007


Author: scott.stark at jboss.org
Date: 2007-12-16 19:11:45 -0500 (Sun, 16 Dec 2007)
New Revision: 68329

Modified:
   trunk/server/src/main/org/jboss/deployment/EARStructure.java
Log:
Correct the handling of the lib directory jar META-INF/persistence.xml check

Modified: trunk/server/src/main/org/jboss/deployment/EARStructure.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EARStructure.java	2007-12-17 00:09:29 UTC (rev 68328)
+++ trunk/server/src/main/org/jboss/deployment/EARStructure.java	2007-12-17 00:11:45 UTC (rev 68329)
@@ -126,6 +126,7 @@
    {
       ContextInfo context = null;
       boolean valid;
+      boolean trace = log.isTraceEnabled();
       try
       {
          if (file.isLeaf() == true || file.getName().endsWith(".ear") == false)
@@ -178,32 +179,47 @@
 
          // Add the ear lib contents to the classpath
          String libDir = appMetaData.getLibraryDirectory() == null ? "lib" : appMetaData.getLibraryDirectory();
+         if(trace)
+            log.trace("Checking for ear lib directory: "+libDir);
          try
          {
             lib = file.findChild(libDir);
             if (lib != null)
             {
+               if(trace)
+                  log.trace("Found ear lib directory: "+lib);
                List<VirtualFile> archives = lib.getChildren(earLibFilter);
                for (VirtualFile archive : archives)
                {
                   super.addClassPath(root, archive, true, true, context);
-                  // add any jars with persistence.xml as a deployment
-                  if (archive.findChild("META-INF/persistence.xml") != null)
+                  try
                   {
-                     log.trace(archive.getName() + " in ear lib directory has persistence units");
-                     if (deployers.determineStructure(root, file, archive, metaData) == false)
+                     // add any jars with persistence.xml as a deployment
+                     if (archive.findChild("META-INF/persistence.xml") != null)
                      {
-                        throw new RuntimeException(archive.getName()
-                              + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
-                              + file.getName());
+                        log.trace(archive.getName() + " in ear lib directory has persistence units");
+                        if (deployers.determineStructure(root, file, archive, metaData) == false)
+                        {
+                           throw new RuntimeException(archive.getName()
+                                 + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
+                                 + file.getName());
+                        }
                      }
                   }
+                  catch(IOException e)
+                  {
+                     // META-INF/persistence.xml does not exist
+                     if(trace)
+                        log.trace(archive.getPathName()+" does not contain META-INF/persistence.xml");
+                  }
                }
             }
          }
          catch (IOException ignored)
          {
             // lib directory does not exist
+            if(trace)
+               log.trace("Ignoring exception while searching for lib dir", ignored);
          }
 
          // Add the ear manifest locations?




More information about the jboss-cvs-commits mailing list