This content has been marked as final.
Show 3 replies
-
1. Re: EAR lib precedence/ordering
alesj Sep 14, 2009 5:17 PM (in response to mmichalek)Off the top of my head, I would say the only way to do this is to rewrite EARStructure class.
I'll have a closer look tomorrow,
providing some example if you still need it. -
2. Re: EAR lib precedence/ordering
alesj Sep 15, 2009 7:05 AM (in response to mmichalek)"alesj" wrote:
Off the top of my head, I would say the only way to do this is to rewrite EARStructure class.
I'll have a closer look tomorrow,
providing some example if you still need it.
This is the code that currently adds ear' lib/ contents to classpath:String libDir = appMetaData.getLibraryDirectory(); if (libDir == null || libDir.length() > 0) { if (libDir == null) libDir = "lib"; // Add the ear lib contents to the classpath if(trace) log.trace("Checking for ear lib directory: "+libDir); try { lib = file.getChild(libDir); if (lib != null) { if(trace) log.trace("Found ear lib directory: "+lib); List<VirtualFile> archives = lib.getChildren(earLibFilter); for (VirtualFile archive : archives) { addClassPath(structureContext, archive, true, true, context); try { // add any jars with persistence.xml as a deployment if (archive.getChild("META-INF/persistence.xml") != null) { log.trace(archive.getName() + " in ear lib directory has persistence units"); if (structureContext.determineChildStructure(archive) == false) { throw new RuntimeException(archive.getName() + " in lib directory has persistence.xml but is not a recognized deployment, .ear: " + file.getName()); } } else if (trace) log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml"); } catch(IOException e) { // TODO - should we throw this fwd? log.warn("Exception searching for META-INF/persistence.xml in " + archive.getPathName() + ", " + e); } } } else if (trace) log.trace("No lib directory in ear archive."); } catch (IOException e) { // TODO - should we throw this fwd? log.warn("Exception while searching for lib dir: " + e); } } else if (trace) { log.trace("Ignoring library directory, got empty library-directory element."); }
What you need is ordering of archives before processing it. -
3. Re: EAR lib precedence/ordering
mmichalek Sep 15, 2009 9:56 AM (in response to mmichalek)Thanks a lot for the info Ales. I'll give this a try.