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

Exception in thread "main" java.lang.NoSuchMethodError: com.relevantcodes.extentreports.model.Test.setLog(Lcom/relevantcodes/extentreports/model/Log;)V #261

Closed
nikhilmullangi opened this issue Jan 11, 2016 · 20 comments
Labels

Comments

@nikhilmullangi
Copy link

@anshooarora

i'm running my test script, when my script started logging the details i'm getting the below error message.

Exception in thread "main" java.lang.NoSuchMethodError: com.relevantcodes.extentreports.model.Test.setLog(Lcom/relevantcodes/extentreports/model/Log;)V
at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:92)
at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:168)

extent-config.xml

UTF-8
    <!-- title of the document -->
    <documentTitle>ExtentReports 2.0</documentTitle>

    <!-- report name - displayed at top-nav -->
    <reportName>Automation Report</reportName>

    <!-- report headline - displayed at top-nav, after reportHeadline -->
    <reportHeadline> [Headline]</reportHeadline>

    <!-- custom javascript -->
    <scripts>
        <![CDATA[
            $(document).ready(function() {

            });
        ]]>
    </scripts>

    <!-- custom styles -->
    <styles>
        <![CDATA[

        ]]>
    </styles>
</configuration>

java Code

public static ExtentReports extent;
public static ExtentTest test;

extent = new ExtentReports(sreportname, true);
extent.loadConfig(new File("extent-config.xml"));

CommonActions.test.log(LogStatus.INFO, steps.FieldName,"Optional Element Not Found");
CommonActions.test.log(LogStatus.ERROR, steps.FieldName,"Query is returning null value at FeildName");

@karthikbhatnagar
Copy link

Can you share complete code and version

@nikhilmullangi
Copy link
Author

Version 2.40.0

public static ExtentReports extent;

public static ExtentTest test;

Reports();

test = extent.startTest(testCases.TestCaseID, testCases.TestCaseDescription);

WebElement targetElement = driver.findElement(By.xpath(steps.FieldDefinition));
targetElement.sendKeys(Keys.ENTER);
test.log(LogStatus.INFO, steps.FieldName, "Optional element found and Enter Button pressed successfully");
} else {
test.log(LogStatus.INFO, steps.FieldName,"Optional element Not found");
}

Report.txt

@nikhilmullangi
Copy link
Author

Test instance is created but when it is trying to log im getting issue

Jan 11, 2016 11:14:03 AM com.relevantcodes.extentreports.Configuration
INFO: Configurating report from file:/D:/OBP_AUTOMATION_NEW/OBPSelenium-New/ExternalJars/extentreports-java-2.40.0.jar!/com/relevantcodes/extentreports/resources/extent-config.xml
Jan 11, 2016 11:14:03 AM com.relevantcodes.extentreports.Configuration
INFO: Configurating report from extent-config.xml

Exception in thread "main" java.lang.NoSuchMethodError: com.relevantcodes.extentreports.model.Test.setLog(Lcom/relevantcodes/extentreports/model/Log;)V

@karthikbhatnagar
Copy link

Did you recently use 2.40? There is some code that is from previous version I think. Can you do fresh build of project? Sometimes that helps because I have seen when you update jar it uses the old methods and does not reference latest jar.

@karthikbhatnagar
Copy link

Let me check with your code gimme 2 mins

@karthikbhatnagar
Copy link

I tried with same version (eclipse Luna).. No issues.

@nikhilmullangi
Copy link
Author

actually i tried fresh build of project also. anyways i will check again

@karthikbhatnagar
Copy link

Sorry can't be much help maybe Anshoo will able to figure out..

@nikhilmullangi
Copy link
Author

Thanks @karthikbhatnagar

@nikhilmullangi
Copy link
Author

@anshooarora
@karthikbhatnagar

Please find the sample project which i have created and when i'm trying the run getting same error message.

can please try to run the same file and let me know.

Version 2.40.0

Jan 11, 2016 2:44:05 PM com.relevantcodes.extentreports.Configuration
INFO: Configurating report from extent-config.xml
Exception in thread "main" java.lang.NoSuchMethodError: com.relevantcodes.extentreports.model.Test.setLog(Lcom/relevantcodes/extentreports/model/Log;)V
at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:92)
at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:168)
at report.main(report.java:26)

sampleReport.txt

extent-config.txt

@anshooarora
Copy link
Owner

Here is what I get after running your code:

t261

@nikhilmullangi
Copy link
Author

Thanks @anshooarora

Donno what's wrong with my system. i getting the same error message which i have mentioned in earlier post.

Can you please let me know what all external jars you have linked with the project

@agupta89
Copy link

I am also encountering the same error...Please help me to get it resolved.

com.relevantcodes.extentreports.model.Test.setLog(Lcom/relevantcodes/extentreports/model/Log;)V

@anshooarora
Copy link
Owner

@nikhilmullangi - jars: freemarker, jsoup and sqlite. They are included in lib folder if you download from website. If using maven dependency, they will be automatically added.

Can you create a brand new project and use the latest beta from website or use its snapshot version as shown here under Download section.

@anshooarora
Copy link
Owner

@agupta89 - were you also using version 2.10 earlier?

@agupta89
Copy link

@anshooarora :
Yes Anshoo. I have used 2.10 on Jenkins server, nightly builds was running fine till yesterday.

@anshooarora
Copy link
Owner

Most probably a build issue. Can you do a Project->Clean and try again?

@nikhilmullangi
Copy link
Author

@anshooarora

Its Working Now. i have mentioned same folder structure which was mentioned in the snapshot version.

Thanks a ton @anshooarora

@agupta89
Copy link

Tried several times but all in vain. will replace with updated jar. Hope it will work. Thanks a lot @anshooarora .

@anshooarora
Copy link
Owner

This does seem like a build/environment/IDE issue.. Try with the latest SNAPSHOT, looks like it worked for @nikhilmullangi also.

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

4 participants