Error: A JNI error has occurred, please check your installation and try again

2

I have the following exception: how could I resolve it?

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more

the code I'm running is this:

package globalTest;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import pages.contactUsPage;
import pages.fiftyPage;
import pages.footerPage;
import pages.footerProjectsPage;
import pages.hamburgerMenu;

public class suite {
WebDriver driver = new FirefoxDriver();

@BeforeClass
public void beforeClass() {
    // driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    System.out.println("Primera prueba");
}

@AfterClass
public void afterClass() {
    driver.quit();
    System.out.println("finaliza");
}

@Test
public void hamburguer() {
    driver.get(URL);
    hamburgerMenu hamburguer= new hamburgerMenu(driver);
}

@Test(priority = 1, enabled = true, invocationCount = 2)
public void contactUs() {
    driver.get(URL);

    contactUsPage contact = new contactUsPage(driver);
    contact.contact();
    contact.name();
    contact.email();
    contact.subject();
    contact.message();
    contact.send();

}

@Test(priority = 2, enabled = true)
public void contactUs2() {
    driver.get(URL);

    contactUsPage contact = new contactUsPage(driver);
    contact.email();

}

@Test(priority = 3, enabled = true)
public void fiftyPage() {
    driver.get(URL);

    fiftyPage fiftypage = new fiftyPage(driver);
    fiftypage.ourwork();
    fiftypage.fifty();



}

@Test
public void footerpageemail() {
    driver.get(URL);
    footerPage footer = new footerPage(driver);

    footer.hamburguer();
    footer.ourwork();
    footer.fifty();
    footer.up();
    footer.contacemail();

}

@Test
public void footerpagefacebook() {
    driver.get(URL);
    footerPage footer = new footerPage(driver);

    footer.hamburguer();
    footer.ourwork();
    footer.fifty();
    footer.facebook();

}

@Test
public void footerpagelinkendlin() {
    driver.get(URL);
    footerPage footer = new footerPage(driver);

    footer.hamburguer();
    footer.ourwork();
    footer.fifty();
    footer.linkendlin();

}

@Test
public void footerprojectspage() {     
    driver.get(URL);
    footerProjectsPage footerproject = new footerProjectsPage(driver);

    footerproject.hamburguer();
    footerproject.ourwork();
    footerproject.fifty();
    footerproject.mozidorigth();
    footerproject.otteright();
    footerproject.fiftyright();
    footerproject.otteleft();
    footerproject.mozidoleft();
    footerproject.fiftyleft();



}

}

    
asked by Laura 03.10.2016 в 21:48
source

1 answer

1

Laura reviews the error:

  

Caused by: java.lang.ClassNotFoundException:   com.beust.jcommander.ParameterException

It means that this class is not in your project or the package to access it is different.

There is some class in your project that is trying to use class ParameterException but can not find it.

As indicated by @jasilva it seems that class ParameterException belongs to the library jcommander which apparently is not found, if we review the documentation this is the way to add it through Maven

<dependency>
  <groupId>com.beust</groupId>
  <artifactId>jcommander</artifactId>
  <version>1.48</version>
</dependency>
    
answered by 03.10.2016 в 22:32