Bug 297453 - warning ignoring duplicate definition:
Summary: warning ignoring duplicate definition:
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.6.1   Edit
Hardware: Other Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-10 04:39 EST by pandu CLA
Modified: 2013-06-24 11:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pandu CLA 2009-12-10 04:39:52 EST
getting below warning at the time of server start-up. I have only one aop.xml file and that too I commented the content of it still I am getting this warning.

[GenericClassLoader@13c35a2] warning ignoring duplicate definition: zip:/export/home/oracle/bea/user_projects/domains/testServDom/servers/testServ/tmp/_WL_user/inventory/yoh5jv/APP-INF/lib/mslv-aop-filter.jar!/META-INF/aop.xml

[GenericClassLoader@13c35a2] warning ignoring duplicate definition: zip:/export/home/oracle/bea/user_projects/domains/testServDom/servers/testServ/tmp/_WL_user/inventory/yoh5jv/APP-INF/lib/mslv-core.jar!/META-INF/aop-ajc.xml

Environment:
Appserver : weblogic 9.2 MP3
AspectJ : 1.6.1
DB : Oracle 11gR2.
OS : Linux/windowsXP.
Comment 1 Andrew Clement CLA 2009-12-10 13:17:03 EST
AspectJ is making a findResources call against the classloader that has been assigned to it, in order to discover all aop.xml files.  If you have the same jar on the classpath twice, that would cause this message.  It isn't a problem, it is just informational really.  If it isn't easy for you to discover why there is duplication, we may have to turn on trace to get out the classpath being used by the loader, which should make it more obvious.
Comment 2 pandu CLA 2009-12-11 01:33:55 EST
    But we are getting this issue only from 1.6.1. Previously we were using 1.5.2a version, we never get this warning but when we started using 1.6.1 we are facing this issue.
    Are there any changes regarding this in 1.6.1 version.
    Anyway we are checking our classpath for the duplicate entries of our jar files.
Comment 3 Andrew Clement CLA 2009-12-11 02:02:32 EST
I could imagine that warning is new between 1.5.2 and 1.6.1 - I will check for certain.
Comment 4 pandu CLA 2009-12-11 02:22:00 EST
   I have checked for the duplicate entries of jar files which are using aop.xml files in our product, I couldnot see any duplicate entries. So duplicate entries in classpath may be very less chance I guess.
Comment 5 Andrew Clement CLA 2009-12-11 12:05:23 EST
The code is as simple as:

Enumeration xmls = getClassLoader().getResources(name); // where name="aop.xml"

Set seenBefore = new HashSet();
while (xmls.hasMoreElements()) {
  URL xml = (URL) xmls.nextElement();
  if (!seenBefore.contains(xml)) {
    info("using configuration " + weavingContext.getFile(xml));
    definitions.add(DocumentParser.parse(xml));
    seenBefore.add(xml);
  } else {
    warn("ignoring duplicate definition: " + xml);
  }
}

which suggests getResources() returned two identical aop.xmls.

The getResources() call will not only be looking at the classpath of the classloader in question, but it will also be able to see aop.xmls accessible through the parent class loader.

I have checked the commit date and that check was not in AspectJ 1.5.2a

As I say it does not real harm - we don't even parse the duplicates so there it is not expensive if they are found.
Comment 6 pandu CLA 2009-12-14 02:50:49 EST
  Is there anyway that I can avoid this warning by configuring in my environment. Can you provide some patch on this issue.
  Because we dont want to see such warinigs at the time of installation of our product.
  Please suggest the best for us.
Comment 7 Andrew Clement CLA 2010-01-06 19:54:17 EST
i'll try and add a config flag to turn it off in 1.6.8.  Then if you want to ignore what it is saying, you can.
Comment 8 Andrew Clement CLA 2013-06-24 11:06:38 EDT
unsetting the target field which is currently set for something already released