apache / apache/maven-surefire
[SUREFIRE-1427] Surefire-plugin throws NoClassDefFoundError with static initialiser
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Martin Gainty](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mgainty@hotmail.com)** opened **[SUREFIRE-1427](https://issues.apache.org/jira/browse/SUREFIRE-1427?redirect=false)** and commented
when maven-surefire-plugin encounters static initialiser such as
public class AxisDescription {
org.apache.axiom.om.OMFactory omFactory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
//surefire throws NoClassDefFoundError on OMAbstractFactory ?!?!?
//but if i remove static initialiser to wait until runtime to load OMAbstractFactory it loads ok
org.apache.axis2.description.AxisDescription:
public void setDocumentation(String documentation) {
org.apache.axiom.om.OMFactory omFactory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
if (!"".equals(documentation)) {
this.documentation = omFactory.createOMText(documentation);
}
}
why does surefire not find classes referenced by static initialiser?
---
**Affects:** 2.20
Contributor guide
Research direction
No repository file or test is identified; the report points to maven-surefire-plugin 2.20, AxisDescription, and OMAbstractFactory. Start by tracing the reported static-initializer class-loading failure and compare it with the runtime-initialization example; done means a reproducible diagnosis and a regression test or documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100