You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ryan Lubke <ry...@gmail.com> on 2022/07/30 21:47:40 UTC
Class defined on module path not found when running integration tests
Hey Folks,
I’ve been looking into this issue for a couple of days now and have run out of ideas.
Maven Version: 3.8.5
Maven Failsafe Version: 3.0.0-M7
Java Version: 17.0.4
OS: MacOS 12.5/Apple Silicon
The test compiles fine using the module path.
When running my test, however, I receive a failure stating that class jakarta.annotation.Priority is not found.
However, looking at the dependencies:
<~/f/c/d/p/j/p/t/f/rest>-> mvn dependency:list -o | ag annotation
[INFO] jakarta.annotation:jakarta.annotation-api:jar:2.0.0:compile
The jar is certainly there. If I look at the failsafe generated XML, the jar is present on the module path from the test run:
<property name="jdk.module.path" value=“...:/Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar:…”/>
Looking at the JAR itself, the class there"
<~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>-> jar tvf /Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar | ag Priority
457 Mon Oct 12 14:06:30 PDT 2020 jakarta/annotation/Priority.class
<~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>->
As the dependency is transitive, I’ve also tried adding a direct dependency within the test module instead, but the result is the same.
Not sure how to debug this further, thus my asking here.
Any suggestions?
Thanks,
-rl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Class defined on module path not found when running integration tests
Posted by Mantas Gridinas <mg...@gmail.com>.
I remember encountering something similar when I started out using modules.
Basically the error message claiming that class is not found is a bit
misleading because what it really means is "class failed to load". One of
the causes of such failures is improper configuration of one of that class
dependencies (atleast when i encountered it, hibernate validation config
was broken so it would error out).
As delany suggested, try running in classpath mode to figure out the error.
I do not understand why, but module system insists on swallowing the real
cause. If possible, it would be great to produce a minimum working sample
and report it to openjdk team because this is a serious issue with the
module system.
In my case I would introduce unnamed module as a dependency to my actual
modules, so that might have been the issue.
On Sun, Jul 31, 2022, 11:58 Delany <de...@gmail.com> wrote:
> Can you try running it directly without maven/failsafe
> Use
>
> https://maven.apache.org/plugins/maven-dependency-plugin/usage.html#dependency:build-classpath
> Delany
>
> On Sun, 31 Jul 2022 at 08:11, Ryan Lubke <ry...@gmail.com> wrote:
>
> > Hey Folks,
> >
> > I’ve been looking into this issue for a couple of days now and have run
> > out of ideas.
> >
> > Maven Version: 3.8.5
> > Maven Failsafe Version: 3.0.0-M7
> > Java Version: 17.0.4
> > OS: MacOS 12.5/Apple Silicon
> >
> > The test compiles fine using the module path.
> > When running my test, however, I receive a failure stating that class
> > jakarta.annotation.Priority is not found.
> >
> > However, looking at the dependencies:
> >
> > <~/f/c/d/p/j/p/t/f/rest>-> mvn dependency:list -o | ag annotation
> > [INFO] jakarta.annotation:jakarta.annotation-api:jar:2.0.0:compile
> >
> > The jar is certainly there. If I look at the failsafe generated XML, the
> > jar is present on the module path from the test run:
> >
> > <property name="jdk.module.path"
> >
> value=“...:/Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar:…”/>
> >
> > Looking at the JAR itself, the class there"
> >
> > <~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>-> jar tvf
> >
> /Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar
> > | ag Priority
> > 457 Mon Oct 12 14:06:30 PDT 2020 jakarta/annotation/Priority.class
> > <~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>->
> >
> > As the dependency is transitive, I’ve also tried adding a direct
> > dependency within the test module instead, but the result is the same.
> >
> > Not sure how to debug this further, thus my asking here.
> >
> > Any suggestions?
> >
> > Thanks,
> > -rl
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
Re: Class defined on module path not found when running integration tests
Posted by Delany <de...@gmail.com>.
Can you try running it directly without maven/failsafe
Use
https://maven.apache.org/plugins/maven-dependency-plugin/usage.html#dependency:build-classpath
Delany
On Sun, 31 Jul 2022 at 08:11, Ryan Lubke <ry...@gmail.com> wrote:
> Hey Folks,
>
> I’ve been looking into this issue for a couple of days now and have run
> out of ideas.
>
> Maven Version: 3.8.5
> Maven Failsafe Version: 3.0.0-M7
> Java Version: 17.0.4
> OS: MacOS 12.5/Apple Silicon
>
> The test compiles fine using the module path.
> When running my test, however, I receive a failure stating that class
> jakarta.annotation.Priority is not found.
>
> However, looking at the dependencies:
>
> <~/f/c/d/p/j/p/t/f/rest>-> mvn dependency:list -o | ag annotation
> [INFO] jakarta.annotation:jakarta.annotation-api:jar:2.0.0:compile
>
> The jar is certainly there. If I look at the failsafe generated XML, the
> jar is present on the module path from the test run:
>
> <property name="jdk.module.path"
> value=“...:/Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar:…”/>
>
> Looking at the JAR itself, the class there"
>
> <~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>-> jar tvf
> /Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar
> | ag Priority
> 457 Mon Oct 12 14:06:30 PDT 2020 jakarta/annotation/Priority.class
> <~/f/c/d/p/j/p/t/f/r/t/failsafe-reports>->
>
> As the dependency is transitive, I’ve also tried adding a direct
> dependency within the test module instead, but the result is the same.
>
> Not sure how to debug this further, thus my asking here.
>
> Any suggestions?
>
> Thanks,
> -rl
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>