java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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}
    via by Michael O'Cleirigh,
  • 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}
    via by Michael O'Cleirigh,
    • 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)
    No Bugmate found.