Bug 1981486 - Forked test fails with InvocationTargetException: org.apache.commons.lang3.StringUtils
Summary: Forked test fails with InvocationTargetException: org.apache.commons.lang3.St...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: maven-surefire
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mikolaj Izdebski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1987604 1987606
TreeView+ depends on / blocked
 
Reported: 2021-07-12 16:33 UTC by Severin Gehwolf
Modified: 2022-04-22 23:02 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-04-22 23:02:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Severin Gehwolf 2021-07-12 16:33:26 UTC
Description of problem:
surefire tests which fork a new JVM fail with InvocationTargetException: org.apache.commons.lang3.StringUtils error. The same doesn't happen for non-forked tests.

Version-Release number of selected component (if applicable):
# rpm -q maven-surefire
maven-surefire-3.0.0~M4-2.fc35.noarch

How reproducible:
100%

Steps to Reproduce:
1. $ fedpkg clone jdependency && cd jdependency
2. $ fedpkg build jdependency

Actual results:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project jdependency: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed: java.lang.reflect.InvocationTargetException: org/apache/commons/lang3/StringUtils: org.apache.commons.lang3.StringUtils -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.tz78Kh (%build)
    Bad exit status from /var/tmp/rpm-tmp.tz78Kh (%build)
Child return code was: 1
EXCEPTION: [Error()]
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.9/site-packages/mockbuild/util.py", line 600, in do_with_status
    raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode)
mockbuild.exception.Error: Command failed: 
 # bash --login -c /usr/bin/rpmbuild -bb --target noarch --nodeps /builddir/build/SPECS/jdependency.spec

Expected results:
commons-lang3 dependency is added to default classpath of forked JVMs as clearly  those classes are needed.

A work-around is to add the dep to the configuration of maven-surefire settings in the pom, but this doesn't scale.

Comment 1 Severin Gehwolf 2021-07-12 16:33:53 UTC
Example scratch build:

https://koji.fedoraproject.org/koji/taskinfo?taskID=71771100

Comment 2 Severin Gehwolf 2021-07-12 16:34:55 UTC
Example of said work-around:
https://src.fedoraproject.org/rpms/jigawatts/blob/rawhide/f/jigawatts.spec#_57

Comment 3 Jerry James 2021-07-23 19:29:12 UTC
The jol package failed its tests during the mass rebuild for the same reason.

Comment 4 Ben Cotton 2021-08-10 13:12:47 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 5 Mikolaj Izdebski 2021-11-15 14:30:34 UTC
This is caused by downstream patch for unbundling of commons-lang3.

Comment 6 Ben Cotton 2022-02-08 21:27:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 7 Mikolaj Izdebski 2022-04-22 23:02:56 UTC
The issue should be fixed in Fedora rawhide in Maven Surefire 3.0.0~M6

I've created regression test for this bug:
https://src.fedoraproject.org/rpms/maven-surefire/pull-request/5

On Fedora 35 the test failed as expected due to missing commons-lang3:
https://artifacts.dev.testing-farm.io/fe101f9e-aec6-4dd6-ab8e-420ffb358b86/

On Fedora 37 the test succeeded:
https://artifacts.dev.testing-farm.io/a54c3bcb-477d-4248-8136-9662c9b2d87e/

Therefore I believe the bug should be fixed in rawhide and I'm closing it.


Note You need to log in before you can comment on or make changes to this bug.