I suspected that myself and that’s why I wrote a small script that checked ALL
the JAR files, both those pulled in for the web app, as well as those in the
Tomee installation directory, for jakarta.faces.context.ExternalContext class
definition. The result was, as I mentioned in the original post, that I could
find only one JAR, myfaces-api-3.0.2.jar, as expected, to have that definition.
The full list of dependencies in my POM.XML file is:
<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope> <!-- comes with Tomcat -->
</dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>jakartaee-api</artifactId>
<version>9.1.1</version>
<scope>provided</scope> <!-- comes with Tomee -->
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope> <!-- comes with Tomee -->
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>10.0.27</version>
<scope>provided</scope> <!-- comes with Tomee -->
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.1.7.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>6.1.7.Final</version>
</dependency>
<dependency>
<!-- this dependency is required for ANTLR plugin to work; it
provides runtime JARs
for generated parsers -->
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.logging.log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.22</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.mnode.ical4j</groupId>
<artifactId>ical4j</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
<scope>runtime</scope> <!-- can't find out which JAR needs it -->
</dependency>
<dependency>
<groupId>org.ostermiller</groupId>
<artifactId>utils</artifactId>
<version>1.07.00</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>11.0.0</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>cupertino</artifactId>
<version>1.0.8</version>
</dependency>
</dependencies>
I can provide the full list of all JARs, if that would help. The thing that
confuses me that the error message doesn’t clearly say that there’s a duplicate
definition of the jakarta.faces.context.ExternalContext class. If that was the
case, one would reasonably expect that the loader would include the names of
JARs where these duplicate definitions are found. I’m also not sure if one
loader already found the required class, why would web app initialisation code
go with another loader to try the same class? Maybe I’m speculating too far :-)
> On 24 Jul 2023, at 11:55 pm, Jonathan S. Fisher <[email protected]> wrote:
>
> Provided is definitely the correct scope, are you pulling in any other
> "spec" jars by chance into your maven build?
>