I've an standard web project built in Eclipse IDE. My project makes uses of weld and my beans.xml is placed at the following location: build/classes/META-INF/beans.xml
When I try to start Tomcat, the following exception is thrown:java.lang.IllegalStateException: WELD-ENV-000033: Invalid bean archive scanning result - found multiple results with the same reference: /home/openbravo/src/weld/pi-weld-upgrade/build/classes (Attached you can find the complete stack trace)
The problem is caused because the WebAppBeanArchiveScanner is finding my beans.xml file twice:
1) When invoking the scan method of the parent DefaultBeanArchiveScanner class when looking for the META-INF/beans.xml
2) By the WebAppBeanArchiveScanner itself when looking for the /WEB-INF/classes/META-INF/beans.xml. See here.
This is causing that Tomcat can not be started using Eclipse. This problem can be reproduced using Tomcat 8, 8.5 and 9.
Note 1: with this same project structure and location of the beans.xml file, and using and older version of weld (I've tried with 1.1.24) Tomcat 8, 8.5 and 9 start without trouble.
Note 2: this problem usually does not happen when deploying the applicaton in Tomcat without using Eclipse. In this case the beans.xml file is placed at WEB-INF/classes/META-INF/beans.xml. As this path contains the keyword "WEB-INF" the result found by the DefaultBeanArchiveScanner is discarded here.