Cannot get JUnit to work on supplied project, I get NullPointerException



0
When I try to run the MRUnitTest I get an internal error of type java.lang.NullPtrException.
Here is the stack from error log file:
java.lang.NullPointerException
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:420)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:409)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:396)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:387)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:364)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

I have used the IDE to add all 7 supplied Jars to the the Java Build Path:
commons-logging-1.1.1.
hadoop-core-0.20.2
hamcrest-core-1.1
jackson-mapper-lpgl-1.6.7
junit-4.10
mockito-all-1.8.5
mrunit-1.0.1-hadoop1.jar
and finally my JRE system library

Research on StackOverflow.com suggested I might not have JDT installed. I have Juno Eclipse, here is an excerpt from my installation file lines 336-345
org.eclipse.jdt (3.8.1.v201302041200) "Eclipse Java Development Tools" [Resolved]
org.eclipse.jdt.core (3.8.3.v20130121-145325) "Java Development Tools Core" [Active]
org.eclipse.jdt.core.manipulation (1.5.0.v20120523-1543) "Java Code Manipulation Functionality" [Active]
org.eclipse.jdt.debug (3.7.101.v20120913-153601) "JDI Debug Model" [Active]
org.eclipse.jdt.debug.ui (3.6.100.v20120530-1425) "JDI Debug UI" [Active]
org.eclipse.jdt.junit (3.7.100.v20120523-1543) "Java Development Tools JUnit support" [Active]
org.eclipse.jdt.junit.core (3.7.100.v20120523-1257) "Java Development Tools JUnit core support" [Active]
org.eclipse.jdt.junit.runtime (3.4.301.v20120914-131016) "Java Development Tools JUnit Runtime Support" [Resolved]
org.eclipse.jdt.launching (3.6.101.v20130111-183046) "Java Development Tools Launching Support" [Active]
org.eclipse.jdt.ui (3.8.2.v20130107-165834) "Java Development Tools UI" [Active]

So it appears I have JDT.

I suspect it may be something in the Run Configuration. As the Test Runner I have JUnit 4, I'm not really sure if there is anything I need to customize for MRunit.

1 Answer(s)


0

hi Chip,
Please download the Module5_solution.zip from the LMS, extract and import module5-dz project into eclipse, this project has all the required libraries set in pom.xml. Junit is the libraries for testing java programs and MRUnit is required to test java programs written in MapReduce.

In the extracted location of "Module5_solution.zip\module5-dz\target" you will see sample-dz-1.0.jar, you can use this to execute the MRUnit program from command line and verify if you still see the errors.

Thanks

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password