Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException at org.springframework.test.web.servlet.result.MockMvcResultHandlers.<clinit>(MockM‌​vcResultHandlers.java:44) [SPR-13802] #18375

Closed
spring-projects-issues opened this issue Dec 16, 2015 · 1 comment
Assignees
Labels
in: test Issues in the test module type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Matthew D'Andrea opened SPR-13802 and commented

java.lang.NullPointerException at org.springframework.test.web.servlet.result.MockMvcResultHandlers.<clinit>(MockM‌​vcResultHandlers.java:44)

is thrown when making use of MockMvcResultHandlers.print() in one of my JUnit 4.11 tests.

Line 44 of MockM‌​vcResultHandlers looks like this:
private static final Log logger = LogFactory.getLog(MockMvcResultHandlers.class.getPackage().getName());

I've confirmed that it is the getPackage() call that is returning null.

From what I've read, it might be due to how the class loading works with the maven-surefire-plugin when a forkCount of 0. Unfortunately, I can't update to 1 to verify if that will help getPackage() not return null.


Affects: 4.2.3

Reference URL: http://stackoverflow.com/questions/34316917/spring-4-2-java-lang-noclassdeffounderror-could-not-initialize-class-org-sprin/34318307#34318307

Referenced from: commits 935c0a4

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Class.getPackage() is known to be unreliable in certain environments, so we're generally trying to avoid it. I've fixed that logger initialization for 4.2.4. Thanks for raising this!

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants