This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254263 - IllegalArgumentException: Duplicate in children list: META-INF/MANIFEST.MF Children: [AbstractFileObject@1ab0354f[META-INF/MANIFEST.MF], AbstractFileObject@1ab0354f[META-INF/MANIFEST.MF], AbstractFile
Summary: IllegalArgumentException: Duplicate in children list: META-INF/MANIFEST.MF Ch...
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-11 09:30 UTC by ehsavoie
Modified: 2015-08-12 14:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 219081


Attachments
stacktrace (5.46 KB, text/plain)
2015-08-11 09:30 UTC, ehsavoie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ehsavoie 2015-08-11 09:30:14 UTC
This bug was originally marked as duplicate of bug 235332, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 20150615-2382de0d4fff)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.51-b03, Java(TM) SE Runtime Environment, 1.8.0_51-b16
OS: Linux

User Comments:
ehsavoie: Trying to produce the manifest in the war using the maven-bundle-plugin instead of the maven-war-plugin archive configuration.




Stacktrace: 
java.lang.IllegalArgumentException: Duplicate in children list: META-INF/MANIFEST.MF
Children: [AbstractFileObject@1ab0354f[META-INF/MANIFEST.MF], AbstractFileObject@1ab0354f[META-INF/MANIFEST.MF], AbstractFileObject@7203103c[META-INF/maven]]
   at org.openide.filesystems.Ordering.getOrder(Ordering.java:101)
   at org.openide.filesystems.FileUtil.getOrder(FileUtil.java:2118)
   at org.openide.loaders.FolderChildren$1R.getPositionedFolderChildrenPairs(FolderChildren.java:213)
   at org.openide.loaders.FolderChildren$1R.run(FolderChildren.java:198)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
   at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
Comment 1 ehsavoie 2015-08-11 09:30:16 UTC
Created attachment 155263 [details]
stacktrace
Comment 2 ehsavoie 2015-08-11 09:35:14 UTC
Here is the POM extract I'm using to produce the MANIFEST in my war (exploded and archive) : 
           <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <mode>development</mode>
                            <url>${project.url}</url>
                            <key>value</key>
                        </manifestEntries>
                    </archive>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>war</supportedProjectType>
                    </supportedProjectTypes>
                    <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF/MANIFEST.MF</manifestLocation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <manifestFile>${project.build.outputDirectory}/${project.build.finalName}/META-INF/MANIFEST.MF</manifestFile>
                </configuration>
            </plugin>
Comment 3 Jaroslav Havlin 2015-08-11 15:26:23 UTC
I'm sorry, I cannot reproduce this bug.

Can you reproduce it constantly, or does it appear randomly?
Could you please describe exact steps?
(I tried "mvn clean war:exploded war:war" and some similar commands, but everything worked, and "MANIFEST.MF" was contained in the archive only once.)

Thank you for reporting.
Comment 4 ehsavoie 2015-08-11 15:43:33 UTC
Yes it reproduces every time by doing a 'simple' Clean Build.
I 'm using the WildFly netbeans plugin to deploy the war but I might be a little late in terms of Netbeans source code, maybe I should rebuild it.
Comment 5 Jaroslav Havlin 2015-08-12 06:57:24 UTC
I cannot reproduce the bug, but generated .war file is suspicious.

It contains two MANIFEST.MF files, one of them is folder, one of them is a regular file.

When I list content of the .war file using "unzip -l", i see this:

target$ unzip -l mavenWebProject-1.0-SNAPSHOT.war 
Archive:  mavenWebProject-1.0-SNAPSHOT.war
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2015-08-12 08:51   META-INF/
      132  2015-08-12 08:51   META-INF/MANIFEST.MF
        0  2015-08-12 08:51   META-INF/MANIFEST.MF/
        0  2015-08-12 08:51   WEB-INF/
        0  2015-08-12 08:51   WEB-INF/classes/
        0  2015-08-12 08:51   WEB-INF/lib/
      352  2015-08-12 08:51   META-INF/MANIFEST.MF/MANIFEST.MF
        0  2015-08-12 08:51   WEB-INF/classes/.netbeans_automatic_build
    60929  2015-08-12 08:51   WEB-INF/lib/org.osgi.core-1.0.0.jar
      244  2015-08-11 17:31   index.html
     4968  2015-08-12 08:47   META-INF/maven/org.nb/mavenWebProject/pom.xml
      121  2015-08-12 08:51   META-INF/maven/org.nb/mavenWebProject/pom.properties
---------                     -------
    66746                     12 files

Can you please check content of your file as well?
(And copy parts of the output related to MANIFEST.MF to new comment?)
Thank you.
Comment 6 Jaroslav Havlin 2015-08-12 07:02:01 UTC
Maybe there just problem in configuration.
Shouldn't "manifestLocation" property in "maven-bundle-plugin" look like this?

> <manifestLocation>
>    ${project.build.directory}/${project.build.finalName}/META-INF
> </manifestLocation>
Comment 7 Jaroslav Havlin 2015-08-12 07:48:12 UTC
Configuration that seems to work fine:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.5.4</version>
    <executions>
        <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
                <goal>manifest</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <archive>
            <manifestEntries>
                <mode>development</mode>
                <url>${project.url}</url>
                <key>value</key>
            </manifestEntries>
        </archive>
        <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>bundle</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
        </supportedProjectTypes>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <archive>  
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
        </archive> 
    </configuration>
</plugin>

 - Removed manifestLocation from maven-bundle-plugin
 - Phase changed to process-classes (maybe does not matter)
 - Wrapped manifestFile in maven-war-plugin with archive

I hope fixing the pom will work.

Duplicate paths in ZIP (JAR, WAR) archives still causes problem in NetBeans, but as it is generally considered to be a bad practice (as far as I know), I think it is not needed to handle this situation. NetBeans platform strongly relies on unique file paths, and changing this would require deep changes. (We could ignore duplicate entries when reading archives, but it could be more confusing than throwing the exception.)

Closing as WONTFIX.
Thank you for reporting.
Comment 8 ehsavoie 2015-08-12 08:21:04 UTC
No that's done on purpose because I want to generate the MANIFEST in the exploded war which I can't have with the war plugin (except for a fixed manifest which might explain the dual manifest issue).
Comment 9 ehsavoie 2015-08-12 08:38:46 UTC
To reproduce I had to open the war file to show me the path to the MANIFEST while building
Comment 10 Jaroslav Havlin 2015-08-12 08:59:16 UTC
(In reply to ehsavoie from comment #9)
> To reproduce I had to open the war file to show me the path to the MANIFEST
> while building
Thank you. Eventually, I was able to reproduce the exception.

(In reply to ehsavoie from comment #8)
> No that's done on purpose because I want to generate the MANIFEST in the
> exploded war which I can't have with the war plugin (except for a fixed
> manifest which might explain the dual manifest issue).
So the path META-INF/MANIFEST.MF/MANIFEST.MF is intentional and correct?
Comment 11 ehsavoie 2015-08-12 10:16:11 UTC
>>So the path META-INF/MANIFEST.MF/MANIFEST.MF is intentional and correct?
Not exactly I want to get META-INF/MANIFEST.MF ;) so there was a slight error there because of :
<manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF/MANIFEST.MF</manifestLocation>
should have been :
<manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
Comment 12 Jaroslav Havlin 2015-08-12 14:24:55 UTC
(In reply to ehsavoie from comment #11)
> >>So the path META-INF/MANIFEST.MF/MANIFEST.MF is intentional and correct?
> Not exactly I want to get META-INF/MANIFEST.MF ;) so there was a slight
> error there because of :
> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-
> INF/MANIFEST.MF</manifestLocation>
> should have been :
> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-
> INF</manifestLocation>
OK, fixing this should also fix the NetBeans problem.
Comment 13 ehsavoie 2015-08-12 14:32:28 UTC
so it seems