java.lang.IllegalArgumentException: Version can not be null

ca.com | 5 months ago
  1. 0
    Invalid http request, probably hacking with manually crafted requests.
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Running the following test results in an error message that is not particularly helpful: package com.foo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class MyTests { @Test public void foo() { // ... } } The resulting stack trace: java.lang.IllegalArgumentException: contextLoader can not be null. at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.test.context.TestContext.buildApplicationContext(TestContext.java:176) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:216) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:58) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:205) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:109) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:156) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) As it turns out, the test is simply missing a @ContextConfiguration annotation. The exception's message could be improved to suggest this as a possible resolution to the user. Here's a patch that adds this bit of user-friendliness: --- ./spring/tiger/mock/org/springframework/test/context/TestContext.java 2007-09-24 09:57:41.000000000 -0700 +++ ./JdoTxnSimple/src/main/java/org/springframework/test/context/TestContext.java 2007-09-29 16:10:53.000000000 -0700 @@ -177,7 +173,8 @@ * context */ protected ApplicationContext buildApplicationContext() throws Exception { - Assert.notNull(getContextLoader(), "contextLoader can not be null."); + Assert.notNull(getContextLoader(), "contextLoader can not be null. " + + "Did you forget to add a @ContextConfiguration annotation on your test class?"); Assert.notNull(getLocations(), "locations can not be null."); return getContextLoader().loadContext(getLocations()); } Thanks!

    Spring JIRA | 9 years ago | Chris Beams
    java.lang.IllegalArgumentException: contextLoader can not be null.
  4. 0

    Read concern can not be null exception with MongoDB driver 3.2.0

    GitHub | 1 year ago | ddossot
    java.lang.IllegalArgumentException: readConcern can not be null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Version can not be null

      at com.ca.mdo.common.util.Version.<init>()
    2. com.ca.mdo
      CollectorController.uploadSdkMsg
      1. com.ca.mdo.common.util.Version.<init>(Version.java:16)
      2. com.ca.mdo.collector.controller.CollectorController.uploadSdkMsg(CollectorController.java:193)
      2 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    4. OpenEJB :: OSGi :: Core
      StatsInterceptor.invoke
      1. org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
      2. org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
      3. org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
      4. org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
      4 frames
    5. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3. java.lang.reflect.Method.invoke(Method.java:497)
      3 frames
    6. OpenEJB :: OSGi :: Core
      ProxyEJB$Handler.invoke
      1. org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
      2. org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
      3. org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
      4. org.apache.openejb.core.singleton.SingletonContainer._invoke(SingletonContainer.java:256)
      5. org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:212)
      6. org.apache.openejb.util.proxy.ProxyEJB$Handler.invoke(ProxyEJB.java:74)
      6 frames