You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.NullPointerException at org.springframework.test.web.servlet.result.MockMvcResultHandlers.<clinit>(MockMvcResultHandlers.java:44) [SPR-13802]
#18375
java.lang.NullPointerException at org.springframework.test.web.servlet.result.MockMvcResultHandlers.<clinit>(MockMvcResultHandlers.java:44)
is thrown when making use of MockMvcResultHandlers.print() in one of my JUnit 4.11 tests.
Line 44 of MockMvcResultHandlers 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.
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!
Matthew D'Andrea opened SPR-13802 and commented
java.lang.NullPointerException at org.springframework.test.web.servlet.result.MockMvcResultHandlers.<clinit>(MockMvcResultHandlers.java:44)
is thrown when making use of MockMvcResultHandlers.print() in one of my JUnit 4.11 tests.
Line 44 of MockMvcResultHandlers 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
The text was updated successfully, but these errors were encountered: