java.lang.NullPointerException

Kuali JIRA | Michael O'Cleirigh | 4 years ago
  1. 0

    When running TestCourseOfferingServiceImplWithClass2Mocks validation of registration groups fail, during the initial data load, with a null pointer exception. This is because the *BaseKuali.code* field which is defined for the *RegistrationGroup.registrationCode* field uses an _AlphaNumericPatternConstraint_. When evaluated as part of the on save validate it internally does a static singleton lookup to load the *kualiConfigurationService* but the _getResourceLoader()_ method resolves to null and thus throws the exception below. The solution is to figure out what is missing from the test datadictionary setup that will allow the kualiConfigurationService and the GlobalResourceLocator to be setup properly to return the required data during evaluation. The application context for the TestCourseOfferingServiceImplWithClass2Mocks includes: {code} <import resource="classpath:META-INF/default-property-config-context-test.xml"/> <import resource="classpath:ks-data-dictionary-services-configuration.xml"/> <import resource="classpath:ks-data-dictionary-validator-configuration.xml"/> <bean id="systemPropertyConfigurer" class="org.kuali.student.common.util.SystemPropertyConfigurer"> <property name="properties" value="${propertiesPrefix.systemProperties}" /> </bean> {code} {code} java.lang.NullPointerException at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:133) at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:144) at org.kuali.rice.krad.service.KRADServiceLocator.getService(KRADServiceLocator.java:39) at org.kuali.rice.krad.service.KRADServiceLocator.getKualiConfigurationService(KRADServiceLocator.java:63) at org.kuali.rice.krad.datadictionary.validation.constraint.AllowCharacterConstraint.getValidationMessageParams(AllowCharacterConstraint.java:527) at org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint.getValidationMessageParamsArray(BaseConstraint.java:105) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.doProcessFormattableValidCharConstraint(ValidCharactersConstraintProcessor.java:129) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.processSingleValidCharacterConstraint(ValidCharactersConstraintProcessor.java:91) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:62) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:47) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processConstraints(DictionaryValidationServiceImpl.java:951) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processElementConstraints(DictionaryValidationServiceImpl.java:855) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validateObject(DictionaryValidationServiceImpl.java:1049) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:797) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:197) at org.kuali.student.r2.common.datadictionary.RiceDataDictionaryValidatorImpl.validate(RiceDataDictionaryValidatorImpl.java:84) at org.kuali.student.r2.core.class1.util.ValidationUtils.validateInfo(ValidationUtils.java:49) at org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.validateRegistrationGroup(CourseOfferingServiceValidationDecorator.java:242) at org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.createRegistrationGroup(CourseOfferingServiceValidationDecorator.java:207) at org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.createCourseENG101(CourseOfferingServiceTestDataLoader.java:448) at org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.beforeTest(CourseOfferingServiceTestDataLoader.java:165) at org.kuali.student.enrollment.class2.courseoffering.service.impl.TestCourseOfferingServiceImplWithClass2Mocks.setup(TestCourseOfferingServiceImplWithClass2Mocks.java:122) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {code}

    Kuali JIRA | 4 years ago | Michael O'Cleirigh
    java.lang.NullPointerException
  2. 0

    When running TestCourseOfferingServiceImplWithClass2Mocks validation of registration groups fail, during the initial data load, with a null pointer exception. This is because the *BaseKuali.code* field which is defined for the *RegistrationGroup.registrationCode* field uses an _AlphaNumericPatternConstraint_. When evaluated as part of the on save validate it internally does a static singleton lookup to load the *kualiConfigurationService* but the _getResourceLoader()_ method resolves to null and thus throws the exception below. The solution is to figure out what is missing from the test datadictionary setup that will allow the kualiConfigurationService and the GlobalResourceLocator to be setup properly to return the required data during evaluation. The application context for the TestCourseOfferingServiceImplWithClass2Mocks includes: {code} <import resource="classpath:META-INF/default-property-config-context-test.xml"/> <import resource="classpath:ks-data-dictionary-services-configuration.xml"/> <import resource="classpath:ks-data-dictionary-validator-configuration.xml"/> <bean id="systemPropertyConfigurer" class="org.kuali.student.common.util.SystemPropertyConfigurer"> <property name="properties" value="${propertiesPrefix.systemProperties}" /> </bean> {code} {code} java.lang.NullPointerException at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:133) at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:144) at org.kuali.rice.krad.service.KRADServiceLocator.getService(KRADServiceLocator.java:39) at org.kuali.rice.krad.service.KRADServiceLocator.getKualiConfigurationService(KRADServiceLocator.java:63) at org.kuali.rice.krad.datadictionary.validation.constraint.AllowCharacterConstraint.getValidationMessageParams(AllowCharacterConstraint.java:527) at org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint.getValidationMessageParamsArray(BaseConstraint.java:105) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.doProcessFormattableValidCharConstraint(ValidCharactersConstraintProcessor.java:129) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.processSingleValidCharacterConstraint(ValidCharactersConstraintProcessor.java:91) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:62) at org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:47) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processConstraints(DictionaryValidationServiceImpl.java:951) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processElementConstraints(DictionaryValidationServiceImpl.java:855) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validateObject(DictionaryValidationServiceImpl.java:1049) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:797) at org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:197) at org.kuali.student.r2.common.datadictionary.RiceDataDictionaryValidatorImpl.validate(RiceDataDictionaryValidatorImpl.java:84) at org.kuali.student.r2.core.class1.util.ValidationUtils.validateInfo(ValidationUtils.java:49) at org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.validateRegistrationGroup(CourseOfferingServiceValidationDecorator.java:242) at org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.createRegistrationGroup(CourseOfferingServiceValidationDecorator.java:207) at org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.createCourseENG101(CourseOfferingServiceTestDataLoader.java:448) at org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.beforeTest(CourseOfferingServiceTestDataLoader.java:165) at org.kuali.student.enrollment.class2.courseoffering.service.impl.TestCourseOfferingServiceImplWithClass2Mocks.setup(TestCourseOfferingServiceImplWithClass2Mocks.java:122) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {code}

    Kuali JIRA | 4 years ago | Michael O'Cleirigh
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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.NullPointerException

      No message provided

      at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService()
    2. org.kuali.rice
      DictionaryValidationServiceImpl.validate
      1. org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:133)
      2. org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.getService(GlobalResourceLoader.java:144)
      3. org.kuali.rice.krad.service.KRADServiceLocator.getService(KRADServiceLocator.java:39)
      4. org.kuali.rice.krad.service.KRADServiceLocator.getKualiConfigurationService(KRADServiceLocator.java:63)
      5. org.kuali.rice.krad.datadictionary.validation.constraint.AllowCharacterConstraint.getValidationMessageParams(AllowCharacterConstraint.java:527)
      6. org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint.getValidationMessageParamsArray(BaseConstraint.java:105)
      7. org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.doProcessFormattableValidCharConstraint(ValidCharactersConstraintProcessor.java:129)
      8. org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.processSingleValidCharacterConstraint(ValidCharactersConstraintProcessor.java:91)
      9. org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:62)
      10. org.kuali.rice.krad.datadictionary.validation.processor.ValidCharactersConstraintProcessor.process(ValidCharactersConstraintProcessor.java:47)
      11. org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processConstraints(DictionaryValidationServiceImpl.java:951)
      12. org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.processElementConstraints(DictionaryValidationServiceImpl.java:855)
      13. org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validateObject(DictionaryValidationServiceImpl.java:1049)
      14. org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:797)
      15. org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl.validate(DictionaryValidationServiceImpl.java:197)
      15 frames
    3. org.kuali.student
      TestCourseOfferingServiceImplWithClass2Mocks.setup
      1. org.kuali.student.r2.common.datadictionary.RiceDataDictionaryValidatorImpl.validate(RiceDataDictionaryValidatorImpl.java:84)
      2. org.kuali.student.r2.core.class1.util.ValidationUtils.validateInfo(ValidationUtils.java:49)
      3. org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.validateRegistrationGroup(CourseOfferingServiceValidationDecorator.java:242)
      4. org.kuali.student.enrollment.class2.courseoffering.service.decorators.CourseOfferingServiceValidationDecorator.createRegistrationGroup(CourseOfferingServiceValidationDecorator.java:207)
      5. org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.createCourseENG101(CourseOfferingServiceTestDataLoader.java:448)
      6. org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingServiceTestDataLoader.beforeTest(CourseOfferingServiceTestDataLoader.java:165)
      7. org.kuali.student.enrollment.class2.courseoffering.service.impl.TestCourseOfferingServiceImplWithClass2Mocks.setup(TestCourseOfferingServiceImplWithClass2Mocks.java:122)
      7 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. JUnit
      RunBefores.evaluate
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
      4 frames
    6. Spring TestContext
      RunBeforeTestMethodCallbacks.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
      1 frame
    7. JUnit
      RunAfters.evaluate
      1. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
      1 frame
    8. Spring TestContext
      SpringJUnit4ClassRunner.runChild
      1. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
      2. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
      3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      3 frames
    9. JUnit
      ParentRunner$2.evaluate
      1. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      2. org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      3. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      4. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      5. org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      6. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      6 frames
    10. Spring TestContext
      RunAfterTestClassCallbacks.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      2 frames
    11. JUnit
      ParentRunner.run
      1. org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      1 frame
    12. Spring TestContext
      SpringJUnit4ClassRunner.run
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      1 frame
    13. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      1 frame
    14. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames