Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Throws NullPointerException when running from Ant using maven #470

Open
gitissuepost opened this issue May 10, 2016 · 5 comments
Open

Throws NullPointerException when running from Ant using maven #470

gitissuepost opened this issue May 10, 2016 · 5 comments
Labels

Comments

@gitissuepost
Copy link

Hello Anshoo,

I am a beginner to ExtentReport. While executing my test project, I got NullPointerException while initializing the ExtentReports object.

I am using Maven and Ant in my project. While executing the project from Ant, I am getting this exception, but while executing the source file directly, I am not getting any exception.
ExtentReportTest.zip

OutPut :
Ant Script Result.txt

Thanks.

@anshooarora
Copy link
Owner

Are you loading a config file? If yes, does the file exist?

@gitissuepost
Copy link
Author

No, I am not loading the config file. I hope, if I don't load the config, it will take the default one that is there with the Jar.

Also, I have added my project source code for your reference.

@vaibhavst
Copy link

Hi gitissuepost / anshooarora ,
I am newbie to ExtentReports, I am constantly getting following error when I try to execute the sample java code for ExtentReports

Exception in thread "main" java.lang.NullPointerException
at com.relevantcodes.extentreports.Report.(Report.java:606)
at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:72)
at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:418)
at com.test.ETREports.main(ETREports.java:14)
My code sample is here

public class ETREports {
public static ExtentReports extent;
public static void main(String[] args) {
extent = new ExtentReports("C:\SampleReports\Report.html"); //This is line number 14 where I get error

I am using extentreports-java-2.41.0.jar , am missing something basic here ?

Thanks
Vaibhav

@anshooarora
Copy link
Owner

@gitissuepost - can you add the extent-reports jar from the website along with all dependencies or via pom.xml and try again?

@vaibhavst - Do you have all the dependencies added?

@gitissuepost
Copy link
Author

gitissuepost commented Jun 14, 2016

@anshooarora - It's working fine when I am running the code directly. But when I am running from Ant build.xml, it's throwing error. In both the case, I am using Maven

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants