NoClassDefFoundError: org.openqa.selenium.Capabilities

1,444 views
Skip to first unread message

Pat

unread,
Sep 4, 2015, 11:46:43 PM9/4/15
to Selenium Users
I'm new to Java and I'm running into a problem. 

When I run the tests in the IDE (NetBeans 7.4) everything runs fine. I have a Hub and a few Nodes setup.

But when I try to execute the jar I get this error:

A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities

I'll include the pom.xml, let me know if you need anything else. Thanks.

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.blabla</groupId>
  <artifactId>SeleniumTest2</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>

  <name>SeleniumTest2</name>

  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency> 
        <groupId>org.seleniumhq.selenium</groupId> 
        <artifactId>selenium-java</artifactId> 
        <version>2.47.1</version> 
    </dependency>
  </dependencies>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib/</classpathPrefix>
              <mainClass>com.blabla.seleniumtest2.App</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Krishnan Mahadevan

unread,
Sep 7, 2015, 1:09:11 AM9/7/15
to seleniu...@googlegroups.com
If you are bent upon using Maven Jar plugin, then you might want to take a look at this specific solution in StackOverFlow : http://stackoverflow.com/a/4323501

The problem is because you haven’t bundled all your required dependencies in your uber jar.

You could also use the Maven assembly plugin as well [ this is documented in the same above mentioned StackOverFlow link ] 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d765b024-2f17-40be-b580-8bbb8e661b0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages